using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using PickGold.Charting.ChartTypes;
using PickGold.Charting.Utilities;
using PickGold.Charting.Design;

namespace PickGold.Charting
{
	[DefaultProperty("Axes"), SRDescription("DescriptionAttributeChartArea_ChartArea"), AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
	public class ChartArea : ChartNamedElement
	{
		private AreaAlignmentOrientations _alignmentOrientation;
		private AreaAlignmentStyles _alignmentStyle;
		private string _alignWithChartArea;
		private ChartArea3DStyle _area3DStyle;
		private ElementPosition _areaPosition;
		private Axis[] _axisArray;
		private Color _backColor;
		private GradientStyle _backGradientStyle;
		private ChartHatchStyle _backHatchStyle;
		private string _backImage;
		private ChartImageAlignmentStyle _backImageAlignment;
		private Color _backImageTransparentColor;
		private ChartImageWrapMode _backImageWrapMode;
		private Color _backSecondaryColor;
		private Color _borderColor;
		private ChartDashStyle _borderDashStyle;
		private int _borderWidth;
		private ArrayList _circularAxisList;
		private int _circularSectorNumber;
		private int _circularUsePolygons;
		private ElementPosition _innerPlotPosition;
		private Series _intervalSeries;
		private string _intervalSeriesList;
		private bool _isSameFontSizeForAllAxes;
		private double _pointsDepth;
		private double _pointsGapDepth;
		private bool _reverseSeriesOrder;
		private List<string> _series;
		private Color _shadowColor;
		private int _shadowOffset;
		private ArrayList _stackGroupNames;
		private bool _visible;
		private SurfaceNames _visibleSurfaces;
		internal bool alignmentInProcess;
		internal float areaSceneDepth;
		internal SizeF areaSceneWallWidth;
		internal float axesAutoFontSize;
		internal Axis axisX;
		internal Axis axisX2;
		internal Axis axisY;
		internal Axis axisY2;
		internal bool chartAreaIsCurcular;
		internal ArrayList chartTypes;
		internal PointF circularCenter;
		internal bool diffIntervalAlignmentChecked;
		internal bool hundredPercent;
		internal bool hundredPercentNegative;
		internal double intervalData;
		internal double intervalLogData;
		internal bool intervalSameSize;
		internal int IterationCounter;
		internal RectangleF lastAreaPosition;
		internal Matrix3D matrix3D;
		internal bool oldReverseX;
		internal bool oldReverseY;
		internal int oldYAngle;
		internal RectangleF originalAreaPosition;
		internal RectangleF originalInnerPlotPosition;
		internal ElementPosition PlotAreaPosition;
		internal bool requireAxes;
		internal bool secondYScale;
		internal List<List<string>> seriesClusters;
		internal SmartLabel smartLabels;
		internal bool stacked;
		internal bool switchValueAxes;

		public ChartArea()
		{
			this._axisArray = new Axis[4];
			this._backColor = Color.Empty;
			this._backImage = "";
			this._backImageTransparentColor = Color.Empty;
			this._backSecondaryColor = Color.Empty;
			this._borderColor = Color.Black;
			this._borderWidth = 1;
			this._shadowColor = Color.FromArgb(0x80, 0, 0, 0);
			this.axesAutoFontSize = 8f;
			this._alignWithChartArea = "NotSet";
			this._alignmentOrientation = AreaAlignmentOrientations.Vertical;
			this._alignmentStyle = AreaAlignmentStyles.All;
			this._circularSectorNumber = -2147483648;
			this._circularUsePolygons = -2147483648;
			this.originalAreaPosition = RectangleF.Empty;
			this.originalInnerPlotPosition = RectangleF.Empty;
			this.lastAreaPosition = RectangleF.Empty;
			this.circularCenter = PointF.Empty;
			this.smartLabels = new SmartLabel();
			this._visible = true;
			this._area3DStyle = new ChartArea3DStyle();
			this.matrix3D = new Matrix3D();
			this.areaSceneWallWidth = SizeF.Empty;
			this.oldYAngle = 30;
			this._series = new List<string>();
			this.chartTypes = new ArrayList();
			this._intervalSeriesList = "";
			this.intervalData = double.NaN;
			this.intervalLogData = double.NaN;
			this.requireAxes = true;
			this.Initialize();
		}

		public ChartArea(string name)
			: base(name)
		{
			this._axisArray = new Axis[4];
			this._backColor = Color.Empty;
			this._backImage = "";
			this._backImageTransparentColor = Color.Empty;
			this._backSecondaryColor = Color.Empty;
			this._borderColor = Color.Black;
			this._borderWidth = 1;
			this._shadowColor = Color.FromArgb(0x80, 0, 0, 0);
			this.axesAutoFontSize = 8f;
			this._alignWithChartArea = "NotSet";
			this._alignmentOrientation = AreaAlignmentOrientations.Vertical;
			this._alignmentStyle = AreaAlignmentStyles.All;
			this._circularSectorNumber = -2147483648;
			this._circularUsePolygons = -2147483648;
			this.originalAreaPosition = RectangleF.Empty;
			this.originalInnerPlotPosition = RectangleF.Empty;
			this.lastAreaPosition = RectangleF.Empty;
			this.circularCenter = PointF.Empty;
			this.smartLabels = new SmartLabel();
			this._visible = true;
			this._area3DStyle = new ChartArea3DStyle();
			this.matrix3D = new Matrix3D();
			this.areaSceneWallWidth = SizeF.Empty;
			this.oldYAngle = 30;
			this._series = new List<string>();
			this.chartTypes = new ArrayList();
			this._intervalSeriesList = "";
			this.intervalData = double.NaN;
			this.intervalLogData = double.NaN;
			this.requireAxes = true;
			this.Initialize();
		}

		private void Activate(Axis axis, bool active)
		{
			if (axis.autoEnabled)
			{
				axis.enabled = active;
			}
		}

		private bool AllEmptyPoints()
		{
			foreach (var str in this._series)
			{
				var series = base.Common.DataManager.Series[str];
				foreach (DataPoint point in series.Points)
				{
					if (!point.IsEmpty)
					{
						return false;
					}
				}
			}
			return true;
		}

		private void CheckSurfaceOrientation(COPCoordinates coord, Point3D point1, Point3D point2, out bool xSameOrientation, out bool ySameOrientation, out bool zSameOrientation)
		{
			bool flag;
			bool flag2;
			Point3D[] points = new Point3D[3];
			xSameOrientation = true;
			ySameOrientation = true;
			zSameOrientation = true;
			if ((coord & COPCoordinates.X) == COPCoordinates.X)
			{
				points[0] = new Point3D(point1.X, this.PlotAreaPosition.Y, 0f);
				points[1] = new Point3D(point1.X, this.PlotAreaPosition.Bottom, 0f);
				points[2] = new Point3D(point1.X, this.PlotAreaPosition.Bottom, this.areaSceneDepth);
				this.matrix3D.TransformPoints(points);
				flag = ChartGraphics.IsSurfaceVisible(points[0], points[1], points[2]);
				points[0] = new Point3D(point2.X, this.PlotAreaPosition.Y, 0f);
				points[1] = new Point3D(point2.X, this.PlotAreaPosition.Bottom, 0f);
				points[2] = new Point3D(point2.X, this.PlotAreaPosition.Bottom, this.areaSceneDepth);
				this.matrix3D.TransformPoints(points);
				flag2 = ChartGraphics.IsSurfaceVisible(points[0], points[1], points[2]);
				xSameOrientation = flag == flag2;
			}
			if ((coord & COPCoordinates.Y) == COPCoordinates.Y)
			{
				points[0] = new Point3D(this.PlotAreaPosition.X, point1.Y, this.areaSceneDepth);
				points[1] = new Point3D(this.PlotAreaPosition.X, point1.Y, 0f);
				points[2] = new Point3D(this.PlotAreaPosition.Right, point1.Y, 0f);
				this.matrix3D.TransformPoints(points);
				flag = ChartGraphics.IsSurfaceVisible(points[0], points[1], points[2]);
				points[0] = new Point3D(this.PlotAreaPosition.X, point2.Y, this.areaSceneDepth);
				points[1] = new Point3D(this.PlotAreaPosition.X, point2.Y, 0f);
				points[2] = new Point3D(this.PlotAreaPosition.Right, point2.Y, 0f);
				this.matrix3D.TransformPoints(points);
				flag2 = ChartGraphics.IsSurfaceVisible(points[0], points[1], points[2]);
				ySameOrientation = flag == flag2;
			}
			if ((coord & COPCoordinates.Z) == COPCoordinates.Z)
			{
				points[0] = new Point3D(this.PlotAreaPosition.X, this.PlotAreaPosition.Y, point1.Z);
				points[1] = new Point3D(this.PlotAreaPosition.X, this.PlotAreaPosition.Bottom, point1.Z);
				points[2] = new Point3D(this.PlotAreaPosition.Right, this.PlotAreaPosition.Bottom, point1.Z);
				this.matrix3D.TransformPoints(points);
				flag = ChartGraphics.IsSurfaceVisible(points[0], points[1], points[2]);
				points[0] = new Point3D(this.PlotAreaPosition.X, this.PlotAreaPosition.Y, point2.Z);
				points[1] = new Point3D(this.PlotAreaPosition.X, this.PlotAreaPosition.Bottom, point2.Z);
				points[2] = new Point3D(this.PlotAreaPosition.Right, this.PlotAreaPosition.Bottom, point2.Z);
				this.matrix3D.TransformPoints(points);
				flag2 = ChartGraphics.IsSurfaceVisible(points[0], points[1], points[2]);
				zSameOrientation = flag == flag2;
			}
		}

		internal float CircularPositionToAngle(double position)
		{
			double num = 360.0 / Math.Abs((double)(this.AxisX.Maximum - this.AxisX.Minimum));
			return (float)((position * num) + this.AxisX.Crossing);
		}

		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				if (this._axisArray != null)
				{
					foreach (Axis axis in this._axisArray)
					{
						axis.Dispose();
					}
					this._axisArray = null;
				}
				if (this._areaPosition != null)
				{
					this._areaPosition.Dispose();
					this._areaPosition = null;
				}
				if (this._innerPlotPosition != null)
				{
					this._innerPlotPosition.Dispose();
					this._innerPlotPosition = null;
				}
				if (this.PlotAreaPosition != null)
				{
					this.PlotAreaPosition.Dispose();
					this.PlotAreaPosition = null;
				}
			}
			base.Dispose(disposing);
		}

		internal void DrawArea3DScene(ChartGraphics graph, RectangleF position)
		{
			ChartArea area = this;
			this.areaSceneWallWidth = graph.GetRelativeSize(new SizeF((float)this.Area3DStyle.WallWidth, (float)this.Area3DStyle.WallWidth));
			this.areaSceneDepth = this.GetArea3DSceneDepth();
			this.matrix3D.Initialize(position, this.areaSceneDepth, (float)this.Area3DStyle.Inclination, (float)this.Area3DStyle.Rotation, (float)this.Area3DStyle.Perspective, this.Area3DStyle.IsRightAngleAxes);
			this.matrix3D.InitLight(this.Area3DStyle.LightStyle);
			this._visibleSurfaces = graph.GetVisibleSurfaces(position, 0f, this.areaSceneDepth, this.matrix3D);
			Color backColor = area.BackColor;
			if (backColor == Color.Transparent)
			{
				this.areaSceneWallWidth = SizeF.Empty;
			}
			else
			{
				if (backColor == Color.Empty)
				{
					backColor = Color.LightGray;
				}
				if (this.IsBottomSceneWallVisible())
				{
					position.Height += this.areaSceneWallWidth.Height;
				}
				position.Width += this.areaSceneWallWidth.Width;
				if (this.Area3DStyle.Rotation > 0)
				{
					position.X -= this.areaSceneWallWidth.Width;
				}
				RectangleF ef = new RectangleF(position.Location, position.Size);
				float width = this.areaSceneWallWidth.Width;
				float positionZ = -width;
				if (this.IsMainSceneWallOnFront())
				{
					positionZ = this.areaSceneDepth;
				}
				graph.Fill3DRectangle(ef, positionZ, width, this.matrix3D, area.Area3DStyle.LightStyle, backColor, area.BorderColor, area.BorderWidth, area.BorderDashStyle, DrawingOperationTypes.DrawElement);
				ef = new RectangleF(position.Location, position.Size);
				ef.Width = this.areaSceneWallWidth.Width;
				if (!this.IsSideSceneWallOnLeft())
				{
					ef.X = position.Right - this.areaSceneWallWidth.Width;
				}
				graph.Fill3DRectangle(ef, 0f, this.areaSceneDepth, this.matrix3D, area.Area3DStyle.LightStyle, backColor, area.BorderColor, area.BorderWidth, area.BorderDashStyle, DrawingOperationTypes.DrawElement);
				if (this.IsBottomSceneWallVisible())
				{
					ef = new RectangleF(position.Location, position.Size);
					ef.Height = this.areaSceneWallWidth.Height;
					ef.Y = position.Bottom - this.areaSceneWallWidth.Height;
					ef.Width -= this.areaSceneWallWidth.Width;
					if (this.IsSideSceneWallOnLeft())
					{
						ef.X += this.areaSceneWallWidth.Width;
					}
					positionZ = 0f;
					graph.Fill3DRectangle(ef, 0f, this.areaSceneDepth, this.matrix3D, area.Area3DStyle.LightStyle, backColor, area.BorderColor, area.BorderWidth, area.BorderDashStyle, DrawingOperationTypes.DrawElement);
				}
			}
		}

		internal bool DrawPointsInReverseOrder()
		{
			return (this.Area3DStyle.Rotation <= 0);
		}

		internal bool DrawPointsToCenter(ref COPCoordinates coord)
		{
			bool flag = false;
			COPCoordinates coordinates = 0;
			if (this.Area3DStyle.Perspective != 0)
			{
				if ((coord & COPCoordinates.X) == COPCoordinates.X)
				{
					if (((this._visibleSurfaces & SurfaceNames.Left) == 0) && ((this._visibleSurfaces & SurfaceNames.Right) == 0))
					{
						flag = true;
					}
					coordinates |= COPCoordinates.X;
				}
				if ((coord & COPCoordinates.Y) == COPCoordinates.Y)
				{
					if (((this._visibleSurfaces & SurfaceNames.Top) == 0) && ((this._visibleSurfaces & SurfaceNames.Bottom) == 0))
					{
						flag = true;
					}
					coordinates |= COPCoordinates.Y;
				}
				if ((coord & COPCoordinates.Z) != COPCoordinates.Z)
				{
					return flag;
				}
				if (((this._visibleSurfaces & SurfaceNames.Front) == 0) && ((this._visibleSurfaces & SurfaceNames.Back) == 0))
				{
					flag = true;
				}
				coordinates |= COPCoordinates.Z;
			}
			return flag;
		}

		internal bool DrawSeriesToCenter()
		{
			return (((this.Area3DStyle.Perspective != 0) && ((this._visibleSurfaces & SurfaceNames.Front) == 0)) && ((this._visibleSurfaces & SurfaceNames.Back) == 0));
		}

		private void EnableAxes()
		{
			if (this._series != null)
			{
				bool flag = false;
				bool flag2 = false;
				bool flag3 = false;
				bool flag4 = false;
				foreach (var str in this._series)
				{
					var series = base.Common.DataManager.Series[str];
					if (series.XAxisType == AxisType.Primary)
					{
						flag = true;
						this.Activate(this.axisX, true);
					}
					else
					{
						flag3 = true;
						this.Activate(this.axisX2, true);
					}
					if (series.YAxisType == AxisType.Primary)
					{
						flag2 = true;
						this.Activate(this.axisY, true);
					}
					else
					{
						flag4 = true;
						this.Activate(this.axisY2, true);
					}
				}
				if (!flag)
				{
					this.Activate(this.axisX, false);
				}
				if (!flag2)
				{
					this.Activate(this.axisY, false);
				}
				if (!flag3)
				{
					this.Activate(this.axisX2, false);
				}
				if (!flag4)
				{
					this.Activate(this.axisY2, false);
				}
			}
		}

		internal void Estimate3DInterval(ChartGraphics graph)
		{
			bool flag;
			float marksZPosition;
			ChartArea area = this;
			this.areaSceneWallWidth = graph.GetRelativeSize(new SizeF((float)this.Area3DStyle.WallWidth, (float)this.Area3DStyle.WallWidth));
			this.areaSceneDepth = this.GetEstimatedSceneDepth();
			RectangleF innerPlotRectangle = area.Position.ToRectangleF();
			if ((((this.PlotAreaPosition.Width == 0f) && (this.PlotAreaPosition.Height == 0f)) && (!area.InnerPlotPosition.Auto && !area.Position.Auto)) && !area.InnerPlotPosition.Auto)
			{
				innerPlotRectangle.X += (area.Position.Width / 100f) * area.InnerPlotPosition.X;
				innerPlotRectangle.Y += (area.Position.Height / 100f) * area.InnerPlotPosition.Y;
				innerPlotRectangle.Width = (area.Position.Width / 100f) * area.InnerPlotPosition.Width;
				innerPlotRectangle.Height = (area.Position.Height / 100f) * area.InnerPlotPosition.Height;
			}
			int realYAngle = this.GetRealYAngle();
			Matrix3D matrixd = new Matrix3D();
			matrixd.Initialize(innerPlotRectangle, this.areaSceneDepth, (float)this.Area3DStyle.Inclination, (float)realYAngle, (float)this.Area3DStyle.Perspective, this.Area3DStyle.IsRightAngleAxes);
			Point3D[] points = new Point3D[8];
			if (area.switchValueAxes)
			{
				marksZPosition = this.axisX.GetMarksZPosition(out flag);
				points[0] = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Y, marksZPosition);
				points[1] = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Bottom, marksZPosition);
				marksZPosition = this.axisY.GetMarksZPosition(out flag);
				points[2] = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Bottom, marksZPosition);
				points[3] = new Point3D(innerPlotRectangle.Right, innerPlotRectangle.Bottom, marksZPosition);
				marksZPosition = this.axisX2.GetMarksZPosition(out flag);
				points[4] = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Y, marksZPosition);
				points[5] = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Bottom, marksZPosition);
				marksZPosition = this.axisY2.GetMarksZPosition(out flag);
				points[6] = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Y, marksZPosition);
				points[7] = new Point3D(innerPlotRectangle.Right, innerPlotRectangle.Y, marksZPosition);
			}
			else
			{
				marksZPosition = this.axisX.GetMarksZPosition(out flag);
				points[0] = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Bottom, marksZPosition);
				points[1] = new Point3D(innerPlotRectangle.Right, innerPlotRectangle.Bottom, marksZPosition);
				marksZPosition = this.axisY.GetMarksZPosition(out flag);
				points[2] = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Y, marksZPosition);
				points[3] = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Bottom, marksZPosition);
				marksZPosition = this.axisX2.GetMarksZPosition(out flag);
				points[4] = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Y, marksZPosition);
				points[5] = new Point3D(innerPlotRectangle.Right, innerPlotRectangle.Y, marksZPosition);
				marksZPosition = this.axisY2.GetMarksZPosition(out flag);
				points[6] = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Y, marksZPosition);
				points[7] = new Point3D(innerPlotRectangle.X, innerPlotRectangle.Bottom, marksZPosition);
			}
			foreach (Axis axis in area.Axes)
			{
				axis.crossing = axis.tempCrossing;
			}
			matrixd.TransformPoints(points);
			int index = 0;
			foreach (Axis axis2 in area.Axes)
			{
				double num3 = Math.Sqrt((double)(((points[index].X - points[index + 1].X) * (points[index].X - points[index + 1].X)) + ((points[index].Y - points[index + 1].Y) * (points[index].Y - points[index + 1].Y))));
				float num5 = 1f;
				if (!area.switchValueAxes)
				{
					num5 = 0.5f;
				}
				if ((axis2.AxisName == AxisName.X) || (axis2.AxisName == AxisName.X2))
				{
					if (area.switchValueAxes)
					{
						axis2.interval3DCorrection = num3 / ((double)innerPlotRectangle.Height);
					}
					else
					{
						axis2.interval3DCorrection = num3 / ((double)innerPlotRectangle.Width);
					}
				}
				else if (area.switchValueAxes)
				{
					axis2.interval3DCorrection = num3 / ((double)innerPlotRectangle.Width);
				}
				else
				{
					axis2.interval3DCorrection = (num3 / ((double)innerPlotRectangle.Height)) * num5;
				}
				if (axis2.interval3DCorrection < 0.15)
				{
					axis2.interval3DCorrection = 0.15;
				}
				if (axis2.interval3DCorrection > 0.8)
				{
					axis2.interval3DCorrection = 1.0;
				}
				index += 2;
			}
		}

		private Axis FindAxis(AxisPosition axisPosition)
		{
			foreach (Axis axis in this.Axes)
			{
				if (axis.AxisPosition == axisPosition)
					return axis;
			}
			return null;
		}

		internal void FitCircularLabels(ChartGraphics chartGraph, ElementPosition chartAreaPosition, ref RectangleF plotArea, float xTitleSize, float yTitleSize)
		{
			if (this.AxisX.LabelStyle.Enabled)
			{
				var absoluteSize = chartGraph.GetAbsoluteSize(new SizeF(xTitleSize, yTitleSize));
				var absoluteRectangle = chartGraph.GetAbsoluteRectangle(plotArea);
				var areaRectAbs = chartGraph.GetAbsoluteRectangle(chartAreaPosition.ToRectangleF());
				var y = chartGraph.GetAbsolutePoint(new PointF(0f, this.AxisX.markSize + 1f)).Y;
				var circularAxisList = this.GetCircularAxisList();
				var circularAxisLabelsStyle = this.GetCircularAxisLabelsStyle();
				if (this.AxisX.LabelStyle.Enabled && this.AxisX.IsLabelAutoFit)
				{
					this.AxisX.autoLabelFont = base.Common.ChartPicture.FontCache.GetFont(this.AxisX.LabelStyle.Font.FontFamily, 14f, this.AxisX.LabelStyle.Font.Style, GraphicsUnit.Point);
					float labelsSizeEstimate = Math.Min((float)(this.GetCircularLabelsSize(chartGraph, areaRectAbs, absoluteRectangle, absoluteSize) * 1.1f), (float)(absoluteRectangle.Width / 5f));
					labelsSizeEstimate += y;
					this.AxisX.GetCircularAxisLabelsAutoFitFont(chartGraph, circularAxisList, circularAxisLabelsStyle, absoluteRectangle, areaRectAbs, labelsSizeEstimate);
				}
				var width = Math.Min(this.GetCircularLabelsSize(chartGraph, areaRectAbs, absoluteRectangle, absoluteSize), absoluteRectangle.Width / 2.5f);
				width += y;
				absoluteRectangle.X += width;
				absoluteRectangle.Width -= 2f * width;
				absoluteRectangle.Y += width;
				absoluteRectangle.Height -= 2f * width;
				if (absoluteRectangle.Width < 1f)
				{
					absoluteRectangle.Width = 1f;
				}
				if (absoluteRectangle.Height < 1f)
				{
					absoluteRectangle.Height = 1f;
				}
				plotArea = chartGraph.GetRelativeRectangle(absoluteRectangle);
				SizeF relativeSize = chartGraph.GetRelativeSize(new SizeF(width, width));
				this.AxisX.labelSize = relativeSize.Height;
				this.AxisX2.labelSize = relativeSize.Height;
				this.AxisY.labelSize = relativeSize.Width;
				this.AxisY2.labelSize = relativeSize.Width;
			}
		}

		private float GetArea3DSceneDepth()
		{
			var flag = ChartHelper.IndexedSeries(base.Common, this._series.ToArray());
			Series series = null;
			if (this._series.Count > 0)
			{
				series = base.Common.DataManager.Series[this._series[0]];
			}
			var axisX = this.AxisX;
			if (this._series.Count > 0)
			{
				var series2 = base.Common.DataManager.Series[this._series[0]];
				if ((series2 != null) && (series2.XAxisType == AxisType.Secondary))
				{
					axisX = this.AxisX2;
				}
			}
			double interval = 1.0;
			if (!flag)
			{
				bool flag2;
				interval = this.GetPointsInterval(this._series, axisX.IsLogarithmic, axisX.logarithmBase, false, out flag2, out series);
			}
			bool sideBySideSeries = false;
			if (series != null)
			{
				sideBySideSeries = base.Common.ChartTypeRegistry.GetChartType(series.ChartTypeName).SideBySideSeries;
				foreach (string str in this._series)
				{
					if (base.Common.DataManager.Series[str].IsCustomPropertySet("DrawSideBySide"))
					{
						string strA = base.Common.DataManager.Series[str]["DrawSideBySide"];
						if (string.Compare(strA, "False", StringComparison.OrdinalIgnoreCase) == 0)
						{
							sideBySideSeries = false;
						}
						else
						{
							if (string.Compare(strA, "True", StringComparison.OrdinalIgnoreCase) == 0)
							{
								sideBySideSeries = true;
								continue;
							}
							if (string.Compare(strA, "Auto", StringComparison.OrdinalIgnoreCase) != 0)
							{
								throw new InvalidOperationException(SR.ExceptionAttributeDrawSideBySideInvalid);
							}
						}
					}
				}
			}
			var axis = this.AxisX;
			if ((series != null) && (series.XAxisType == AxisType.Secondary))
			{
				axis = this.AxisX2;
			}
			var num2 = 0.8D;
			var count = 1;
			if (((series != null) && this.Area3DStyle.IsClustered) && sideBySideSeries)
			{
				count = 0;
				foreach (var str3 in this._series)
				{
					var series3 = base.Common.DataManager.Series[str3];
					if (string.Compare(series3.ChartTypeName, series.ChartTypeName, StringComparison.OrdinalIgnoreCase) == 0)
						count++;
				}
			}
			if (((series != null) && this.Area3DStyle.IsClustered) && base.Common.ChartTypeRegistry.GetChartType(series.ChartTypeName).SupportStackedGroups)
			{
				count = 0;
				var list = new ArrayList();
				foreach (string str4 in this._series)
				{
					var series4 = base.Common.DataManager.Series[str4];
					if (string.Compare(series4.ChartTypeName, series.ChartTypeName, StringComparison.OrdinalIgnoreCase) == 0)
					{
						var item = string.Empty;
						if (series4.IsCustomPropertySet("StackedGroupName"))
							item = series4["StackedGroupName"];
						if (!list.Contains(item))
							list.Add(item);
					}
				}
				count = list.Count;
			}
			this._pointsDepth = ((interval * num2) * this.Area3DStyle.PointDepth) / 100.0;
			this._pointsDepth = axis.GetPixelInterval(this._pointsDepth);
			if (series != null)
			{
				this._pointsDepth = series.GetPointWidth(base.Common.graph, axis, interval, 0.8) / ((double)count);
				this._pointsDepth *= ((double)this.Area3DStyle.PointDepth) / 100.0;
			}
			this._pointsGapDepth = ((this._pointsDepth * 0.8) * this.Area3DStyle.PointGapDepth) / 100.0;
			if (series != null)
			{
				series.GetPointDepthAndGap(base.Common.graph, axis, ref this._pointsDepth, ref this._pointsGapDepth);
			}
			return (float)((this._pointsGapDepth + this._pointsDepth) * this.GetNumberOfClusters());
		}

		internal Axis GetAxis(AxisName axisName, AxisType axisType, string subAxisName)
		{
			if (this.Area3DStyle.Enable3D)
			{
				subAxisName = string.Empty;
			}
			if ((axisName == AxisName.X) || (axisName == AxisName.X2))
			{
				if (axisType == AxisType.Primary)
				{
					return this.AxisX.GetSubAxis(subAxisName);
				}
				return this.AxisX2.GetSubAxis(subAxisName);
			}
			if (axisType == AxisType.Primary)
			{
				return this.AxisY.GetSubAxis(subAxisName);
			}
			return this.AxisY2.GetSubAxis(subAxisName);
		}

		internal RectangleF GetBackgroundPosition(bool withScrollBars)
		{
			RectangleF ef = this.PlotAreaPosition.ToRectangleF();
			if (!this.requireAxes)
			{
				ef = this.Position.ToRectangleF();
			}
			if (!withScrollBars)
			{
				return ef;
			}
			return new RectangleF(ef.Location, ef.Size);
		}

		internal Point3D GetCenterOfProjection(COPCoordinates coord)
		{
			bool flag;
			bool flag2;
			bool flag3;
			Point3D[] pointdArray = new Point3D[] { new Point3D(this.PlotAreaPosition.X, this.PlotAreaPosition.Bottom, 0f), new Point3D(this.PlotAreaPosition.Right, this.PlotAreaPosition.Y, this.areaSceneDepth) };
			this.CheckSurfaceOrientation(coord, pointdArray[0], pointdArray[1], out flag, out flag2, out flag3);
			Point3D pointd = new Point3D(flag ? float.NaN : 0f, flag2 ? float.NaN : 0f, flag3 ? float.NaN : 0f);
			if (((((coord & COPCoordinates.X) == COPCoordinates.X) && !flag) || (((coord & COPCoordinates.Y) == COPCoordinates.Y) && !flag2)) || (((coord & COPCoordinates.Z) == COPCoordinates.Z) && !flag3))
			{
				SizeF ef = new SizeF(0.5f, 0.5f);
				ef.Width = (ef.Width * 100f) / ((float)(base.Common.Chart.Width.Value - 1.0));
				ef.Height = (ef.Height * 100f) / ((float)(base.Common.Chart.Height.Value - 1.0));
				bool flag4 = false;
				while (!flag4)
				{
					Point3D pointd2 = new Point3D((pointdArray[0].X + pointdArray[1].X) / 2f, (pointdArray[0].Y + pointdArray[1].Y) / 2f, (pointdArray[0].Z + pointdArray[1].Z) / 2f);
					this.CheckSurfaceOrientation(coord, pointdArray[0], pointd2, out flag, out flag2, out flag3);
					pointdArray[flag ? 0 : 1].X = pointd2.X;
					pointdArray[flag2 ? 0 : 1].Y = pointd2.Y;
					pointdArray[flag3 ? 0 : 1].Z = pointd2.Z;
					flag4 = true;
					if (((coord & COPCoordinates.X) == COPCoordinates.X) && (Math.Abs((float)(pointdArray[1].X - pointdArray[0].X)) >= ef.Width))
					{
						flag4 = false;
					}
					if (((coord & COPCoordinates.Y) == COPCoordinates.Y) && (Math.Abs((float)(pointdArray[1].Y - pointdArray[0].Y)) >= ef.Height))
					{
						flag4 = false;
					}
					if (((coord & COPCoordinates.Z) == COPCoordinates.Z) && (Math.Abs((float)(pointdArray[1].Z - pointdArray[0].Z)) >= ef.Width))
					{
						flag4 = false;
					}
				}
				if (!float.IsNaN(pointd.X))
				{
					pointd.X = (pointdArray[0].X + pointdArray[1].X) / 2f;
				}
				if (!float.IsNaN(pointd.Y))
				{
					pointd.Y = (pointdArray[0].Y + pointdArray[1].Y) / 2f;
				}
				if (!float.IsNaN(pointd.Z))
				{
					pointd.Z = (pointdArray[0].Z + pointdArray[1].Z) / 2f;
				}
			}
			return pointd;
		}

		private ArrayList GetChartTypesAndSeriesToDraw()
		{
			var list = new ArrayList();
			if ((this.ChartTypes.Count > 1) && (this.ChartTypes.Contains("Area") || this.ChartTypes.Contains("SplineArea")))
			{
				var list2 = new ArrayList();
				var list3 = new ArrayList();
				int num = 0;
				foreach (var series in base.Common.DataManager.Series)
				{
					if (((series.ChartArea == this.Name) && series.IsVisible()) && ((series.Points.Count > 0) && !list2.Contains(series.ChartTypeName)))
					{
						bool flag = false;
						if (((series.ChartType == SeriesChartType.Point) || (series.ChartType == SeriesChartType.Line)) || ((series.ChartType == SeriesChartType.Spline) || (series.ChartType == SeriesChartType.StepLine)))
						{
							flag = true;
						}
						if (!flag)
						{
							list.Add(new ChartTypeAndSeriesInfo(series.ChartTypeName));
							list2.Add(series.ChartTypeName);
						}
						else
						{
							bool flag2 = false;
							if (list3.Contains(series.ChartTypeName))
							{
								flag2 = true;
							}
							else
							{
								bool flag3 = false;
								for (int i = num + 1; i < base.Common.DataManager.Series.Count; i++)
								{
									if (series.ChartTypeName == base.Common.DataManager.Series[i].ChartTypeName)
									{
										if (flag3)
										{
											flag2 = true;
											list3.Add(series.ChartTypeName);
										}
									}
									else if ((base.Common.DataManager.Series[i].ChartType == SeriesChartType.Area) || (base.Common.DataManager.Series[i].ChartType == SeriesChartType.SplineArea))
									{
										flag3 = true;
									}
								}
							}
							if (flag2)
							{
								list.Add(new ChartTypeAndSeriesInfo(series));
							}
							else
							{
								list.Add(new ChartTypeAndSeriesInfo(series.ChartTypeName));
								list2.Add(series.ChartTypeName);
							}
						}
					}
					num++;
				}
				return list;
			}
			foreach (string str in this.ChartTypes)
			{
				list.Add(new ChartTypeAndSeriesInfo(str));
			}
			return list;
		}

		internal CircularAxisLabelsStyle GetCircularAxisLabelsStyle()
		{
			var auto = CircularAxisLabelsStyle.Auto;
			foreach (var series in base.Common.DataManager.Series)
			{
				if ((series.IsVisible() && (series.ChartArea == this.Name)) && series.IsCustomPropertySet("CircularLabelsStyle"))
				{
					var strA = series["CircularLabelsStyle"];
					if (string.Compare(strA, "Auto", StringComparison.OrdinalIgnoreCase) != 0)
					{
						if (string.Compare(strA, "Circular", StringComparison.OrdinalIgnoreCase) != 0)
						{
							if (string.Compare(strA, "Radial", StringComparison.OrdinalIgnoreCase) != 0)
							{
								if (string.Compare(strA, "Horizontal", StringComparison.OrdinalIgnoreCase) != 0)
									throw new InvalidOperationException(SR.ExceptionCustomAttributeValueInvalid(strA, "CircularLabelsStyle"));

								auto = CircularAxisLabelsStyle.Horizontal;
							}
							else
							{
								auto = CircularAxisLabelsStyle.Radial;
							}
							continue;
						}
						auto = CircularAxisLabelsStyle.Circular;
					}
					else
					{
						auto = CircularAxisLabelsStyle.Auto;
					}
				}
			}
			if (auto == CircularAxisLabelsStyle.Auto)
			{
				int circularSectorsNumber = this.CircularSectorsNumber;
				auto = CircularAxisLabelsStyle.Horizontal;
				if (circularSectorsNumber > 30)
				{
					auto = CircularAxisLabelsStyle.Radial;
				}
			}
			return auto;
		}

		internal ArrayList GetCircularAxisList()
		{
			if (this._circularAxisList == null)
			{
				this._circularAxisList = new ArrayList();
				int circularSectorNumber = this.GetCircularSectorNumber();
				for (int i = 0; i < circularSectorNumber; i++)
				{
					CircularChartAreaAxis axis = new CircularChartAreaAxis((i * 360f) / ((float)circularSectorNumber));
					if (this.AxisX.CustomLabels.Count > 0)
					{
						if (i < this.AxisX.CustomLabels.Count)
						{
							axis.Title = this.AxisX.CustomLabels[i].Text;
							axis.TitleForeColor = this.AxisX.CustomLabels[i].ForeColor;
						}
					}
					else
					{
						foreach (var series in base.Common.DataManager.Series)
						{
							if ((series.IsVisible() && (series.ChartArea == this.Name)) && ((i < series.Points.Count) && (series.Points[i].AxisLabel.Length > 0)))
							{
								axis.Title = series.Points[i].AxisLabel;
								break;
							}
						}
					}
					this._circularAxisList.Add(axis);
				}
			}
			return this._circularAxisList;
		}

		internal ICircularChartType GetCircularChartType()
		{
			foreach (var series in base.Common.DataManager.Series)
			{
				if (series.IsVisible() && (series.ChartArea == this.Name))
				{
					ICircularChartType chartType = base.Common.ChartTypeRegistry.GetChartType(series.ChartTypeName) as ICircularChartType;
					if (chartType != null)
					{
						return chartType;
					}
				}
			}
			return null;
		}

		internal float GetCircularLabelsSize(ChartGraphics chartGraph, RectangleF areaRectAbs, RectangleF plotAreaRectAbs, SizeF titleSize)
		{
			SizeF ef = new SizeF(plotAreaRectAbs.X - areaRectAbs.X, plotAreaRectAbs.Y - areaRectAbs.Y);
			ef.Width -= titleSize.Width;
			ef.Height -= titleSize.Height;
			PointF absolutePoint = chartGraph.GetAbsolutePoint(this.circularCenter);
			ArrayList circularAxisList = this.GetCircularAxisList();
			CircularAxisLabelsStyle circularAxisLabelsStyle = this.GetCircularAxisLabelsStyle();
			float num = 0f;
			foreach (CircularChartAreaAxis axis in circularAxisList)
			{
				SizeF ef2 = chartGraph.MeasureString(axis.Title.Replace(@"\n", "\n"), (this.AxisX.autoLabelFont == null) ? this.AxisX.LabelStyle.Font : this.AxisX.autoLabelFont);
				ef2.Width = (float)Math.Ceiling((double)(ef2.Width * 1.1f));
				ef2.Height = (float)Math.Ceiling((double)(ef2.Height * 1.1f));
				switch (circularAxisLabelsStyle)
				{
					case CircularAxisLabelsStyle.Circular:
						{
							num = Math.Max(num, ef2.Height);
							continue;
						}
					case CircularAxisLabelsStyle.Radial:
						{
							float num2 = axis.AxisPosition + 90f;
							float num3 = ((float)Math.Cos((num2 / 180f) * 3.1415926535897931)) * ef2.Width;
							float num4 = ((float)Math.Sin((num2 / 180f) * 3.1415926535897931)) * ef2.Width;
							num3 = (float)Math.Abs(Math.Ceiling((double)num3));
							num4 = (float)Math.Abs(Math.Ceiling((double)num4));
							num3 -= ef.Width;
							num4 -= ef.Height;
							if (num3 < 0f)
							{
								num3 = 0f;
							}
							if (num4 < 0f)
							{
								num4 = 0f;
							}
							num = Math.Max(num, Math.Max(num3, num4));
							continue;
						}
					case CircularAxisLabelsStyle.Horizontal:
						{
							float axisPosition = axis.AxisPosition;
							if (axisPosition > 180f)
							{
								axisPosition -= 180f;
							}
							PointF[] pts = new PointF[] { new PointF(absolutePoint.X, plotAreaRectAbs.Y) };
							Matrix matrix = new Matrix();
							matrix.RotateAt(axisPosition, absolutePoint);
							matrix.TransformPoints(pts);
							float num6 = ef2.Width - (areaRectAbs.Right - pts[0].X);
							if (num6 < 0f)
							{
								num6 = 0f;
							}
							num = Math.Max(num, Math.Max(num6, ef2.Height));
							break;
						}
				}
			}
			return num;
		}

		private int GetCircularSectorNumber()
		{
			ICircularChartType circularChartType = this.GetCircularChartType();
			if (circularChartType != null)
			{
				return circularChartType.GetNumerOfSectors(this, base.Common.DataManager.Series);
			}
			return 0;
		}

		internal List<string> GetClusterSeriesNames(string seriesName)
		{
			foreach (List<string> list in this.seriesClusters)
			{
				if (list.Contains(seriesName))
				{
					return list;
				}
			}
			return new List<string>();
		}

		internal ArrayList GetDataPointDrawingOrder(List<string> seriesNamesList, IChartType chartType, bool selection, COPCoordinates coord, IComparer comparer, int mainYValueIndex, bool sideBySide)
		{
			ChartArea area = this;
			ArrayList list = new ArrayList();
			double count = 1.0;
			if ((area.Area3DStyle.IsClustered && !chartType.Stacked) && sideBySide)
			{
				count = seriesNamesList.Count;
			}
			if (chartType.SupportStackedGroups)
			{
				int numberOfStackGroups = this.GetNumberOfStackGroups(seriesNamesList);
				if (this.Area3DStyle.IsClustered && (seriesNamesList.Count > 0))
				{
					count = numberOfStackGroups;
				}
			}
			bool flag = ChartHelper.IndexedSeries(base.Common, seriesNamesList.ToArray());
			int seriesStackGroupIndex = 0;
			foreach (object obj2 in seriesNamesList)
			{
				float num6;
				float num7;
				var series = base.Common.DataManager.Series[(string)obj2];
				if (chartType.SupportStackedGroups && (this._stackGroupNames != null))
				{
					string stackGroupName = string.Empty;
					seriesStackGroupIndex = this.GetSeriesStackGroupIndex(series, ref stackGroupName);
					var chart = chartType as StackedColumnChart;
					if (chart != null)
					{
						chart.currentStackGroup = stackGroupName;
					}
					else
					{
						var chart2 = chartType as StackedBarChart;
						if (chart2 != null)
						{
							chart2.currentStackGroup = stackGroupName;
						}
					}
				}
				var axis = (series.YAxisType == AxisType.Primary) ? area.AxisY : area.AxisY2;
				var axis2 = (series.XAxisType == AxisType.Primary) ? area.AxisX : area.AxisX2;
				bool sameInterval = true;
				var interval = 1.0D;
				if (!flag)
					interval = area.GetPointsInterval(seriesNamesList, axis2.IsLogarithmic, axis2.logarithmBase, true, out sameInterval);
				var num5 = series.GetPointWidth(area.Common.graph, axis2, interval, 0.8) / count;
				this.GetSeriesZPositionAndDepth(series, out num6, out num7);
				var num8 = 0;
				foreach (DataPoint point in series.Points)
				{
					double position;
					double num10;
					num8++;
					if (flag)
					{
						num10 = ((axis2.GetPosition((double)num8) - ((num5 * count) / 2.0)) + (num5 / 2.0)) + (seriesStackGroupIndex * num5);
						position = axis2.GetPosition((double)num8);
					}
					else if (sameInterval)
					{
						num10 = ((axis2.GetPosition(point.XValue) - ((num5 * count) / 2.0)) + (num5 / 2.0)) + (seriesStackGroupIndex * num5);
						position = axis2.GetPosition(point.XValue);
					}
					else
					{
						num10 = axis2.GetPosition(point.XValue);
						position = axis2.GetPosition(point.XValue);
					}
					DataPoint3D pointd = new DataPoint3D();
					pointd.indexedSeries = flag;
					pointd.dataPoint = point;
					pointd.index = num8;
					pointd.xPosition = num10;
					pointd.xCenterVal = position;
					pointd.width = series.GetPointWidth(area.Common.graph, axis2, interval, 0.8) / count;
					pointd.depth = num6;
					pointd.zPosition = num7;
					double axisValue = chartType.GetYValue(base.Common, area, series, point, num8 - 1, mainYValueIndex);
					pointd.yPosition = axis.GetPosition(axisValue);
					pointd.height = axis.GetPosition(axisValue - chartType.GetYValue(base.Common, area, series, point, num8 - 1, -1));
					list.Add(pointd);
				}
				if ((count > 1.0) && sideBySide)
				{
					seriesStackGroupIndex++;
				}
			}
			if (comparer == null)
			{
				comparer = new PointsDrawingOrderComparer(this, selection, coord);
			}
			list.Sort(comparer);
			return list;
		}

		private void GetDateInterval(double value1, double value2, out int monthsInteval, out long ticksInterval)
		{
			DateTime time = DateTime.FromOADate(value1);
			DateTime time2 = DateTime.FromOADate(value2);
			monthsInteval = time2.Month - time.Month;
			monthsInteval += (time2.Year - time.Year) * 12;
			ticksInterval = 0L;
			ticksInterval += (time2.Day - time.Day) * 0xc92a69c000L;
			ticksInterval += (time2.Hour - time.Hour) * 0x861c46800L;
			ticksInterval += (time2.Minute - time.Minute) * 0x23c34600L;
			ticksInterval += (time2.Second - time.Second) * 0x989680L;
			ticksInterval += (time2.Millisecond - time.Millisecond) * 0x2710L;
		}

		private float GetEstimatedSceneDepth()
		{
			ChartArea area = this;
			this.seriesClusters = null;
			ElementPosition innerPlotPosition = area.InnerPlotPosition;
			area.AxisX.PlotAreaPosition = area.Position;
			area.AxisY.PlotAreaPosition = area.Position;
			area.AxisX2.PlotAreaPosition = area.Position;
			area.AxisY2.PlotAreaPosition = area.Position;
			float num = this.GetArea3DSceneDepth();
			area.AxisX.PlotAreaPosition = innerPlotPosition;
			area.AxisY.PlotAreaPosition = innerPlotPosition;
			area.AxisX2.PlotAreaPosition = innerPlotPosition;
			area.AxisY2.PlotAreaPosition = innerPlotPosition;
			return num;
		}

		internal Series GetFirstSeries()
		{
			if (this._series.Count == 0)
			{
				throw new InvalidOperationException(SR.ExceptionChartAreaSeriesNotFound);
			}
			return base.Common.DataManager.Series[this._series[0]];
		}

		private int GetNumberOfAllPoints()
		{
			int num = 0;
			foreach (Series series in base.Common.DataManager.Series)
			{
				num += series.Points.Count;
			}
			return num;
		}

		internal int GetNumberOfClusters()
		{
			if (this.seriesClusters == null)
			{
				var count = -1;
				var list = new ArrayList();
				var list2 = new ArrayList();
				this.seriesClusters = new List<List<string>>();
				foreach (var str in this._series)
				{
					var series = base.Common.DataManager.Series[str];
					if (!this.Area3DStyle.IsClustered && base.Common.ChartTypeRegistry.GetChartType(series.ChartTypeName).SupportStackedGroups)
					{
						var seriesStackGroupName = StackedColumnChart.GetSeriesStackGroupName(series);
						if (list2.Contains(seriesStackGroupName))
						{
							var flag = false;
							for (var i = 0; !flag && (i < this.seriesClusters.Count); i++)
							{
								foreach (string str3 in this.seriesClusters[i])
								{
									var series2 = base.Common.DataManager.Series[str3];
									if (seriesStackGroupName == StackedColumnChart.GetSeriesStackGroupName(series2))
									{
										count = i;
										flag = true;
									}
								}
							}
						}
						else
						{
							count = this.seriesClusters.Count;
							list2.Add(seriesStackGroupName);
						}
					}
					else if (base.Common.ChartTypeRegistry.GetChartType(series.ChartTypeName).Stacked || (this.Area3DStyle.IsClustered && base.Common.ChartTypeRegistry.GetChartType(series.ChartTypeName).SideBySideSeries))
					{
						if (list.Contains(series.ChartTypeName.ToUpper(CultureInfo.InvariantCulture)))
						{
							var flag2 = false;
							for (var j = 0; !flag2 && (j < this.seriesClusters.Count); j++)
							{
								foreach (var str4 in this.seriesClusters[j])
								{
									var series3 = base.Common.DataManager.Series[str4];
									if (series3.ChartTypeName.ToUpper(CultureInfo.InvariantCulture) == series.ChartTypeName.ToUpper(CultureInfo.InvariantCulture))
									{
										count = j;
										flag2 = true;
									}
								}
							}
						}
						else
						{
							count = this.seriesClusters.Count;
							list.Add(series.ChartTypeName.ToUpper(CultureInfo.InvariantCulture));
						}
					}
					else
					{
						count = this.seriesClusters.Count;
					}
					if (this.seriesClusters.Count <= count)
					{
						this.seriesClusters.Add(new List<string>());
					}
					this.seriesClusters[count].Add(str);
				}
			}
			return this.seriesClusters.Count;
		}

		private int GetNumberOfStackGroups(IList<string> seriesNamesList)
		{
			this._stackGroupNames = new ArrayList();
			foreach (var obj2 in seriesNamesList)
			{
				var series = base.Common.DataManager.Series[obj2];
				string item = string.Empty;
				if (series.IsCustomPropertySet("StackedGroupName"))
					item = series["StackedGroupName"];
				if (!this._stackGroupNames.Contains(item))
					this._stackGroupNames.Add(item);
			}
			return this._stackGroupNames.Count;
		}

		internal double GetPointsInterval(bool isLogarithmic, double logarithmBase)
		{
			bool flag;
			return this.GetPointsInterval(this._series, isLogarithmic, logarithmBase, false, out flag);
		}

		internal double GetPointsInterval(List<string> seriesList, bool isLogarithmic, double logarithmBase, bool checkSameInterval, out bool sameInterval)
		{
			Series series = null;
			return this.GetPointsInterval(seriesList, isLogarithmic, logarithmBase, checkSameInterval, out sameInterval, out series);
		}

		internal double GetPointsInterval(List<string> seriesList, bool isLogarithmic, double logarithmicBase, bool checkSameInterval, out bool sameInterval, out Series series)
		{
			long ticksInterval = 0x7fffffffffffffffL;
			int monthsInteval = 0;
			double minValue = double.MinValue;
			double maxValue = double.MaxValue;
			sameInterval = true;
			series = null;
			string str = "";
			if (seriesList != null)
			{
				foreach (string str2 in seriesList)
				{
					str = str + str2 + ",";
				}
			}
			if (!checkSameInterval || this.diffIntervalAlignmentChecked)
			{
				if (!isLogarithmic)
				{
					if (!double.IsNaN(this.intervalData) && (this._intervalSeriesList == str))
					{
						sameInterval = this.intervalSameSize;
						series = this._intervalSeries;
						return this.intervalData;
					}
				}
				else if (!double.IsNaN(this.intervalLogData) && (this._intervalSeriesList == str))
				{
					sameInterval = this.intervalSameSize;
					series = this._intervalSeries;
					return this.intervalLogData;
				}
			}
			int index = 0;
			Series series2 = null;
			var listArray = new ArrayList[seriesList.Count];
			foreach (var str3 in seriesList)
			{
				var series3 = base.Common.DataManager.Series[str3];
				var flag = series3.IsXValueDateTime();
				listArray[index] = new ArrayList();
				var flag2 = false;
				var xValue = double.MinValue;
				var num7 = 0.0D;
				if (series3.Points.Count > 0)
				{
					if (isLogarithmic)
						xValue = Math.Log(series3.Points[0].XValue, logarithmicBase);
					else
						xValue = series3.Points[0].XValue;
				}
				foreach (var point in series3.Points)
				{
					if (isLogarithmic)
						num7 = Math.Log(point.XValue, logarithmicBase);
					else
						num7 = point.XValue;
					if (xValue > num7)
						flag2 = true;
					listArray[index].Add(num7);
					xValue = num7;
				}
				if (flag2)
				{
					listArray[index].Sort();
				}
				for (int i = 1; i < listArray[index].Count; i++)
				{
					double num9 = Math.Abs((double)(((double)listArray[index][i - 1]) - ((double)listArray[index][i])));
					if (sameInterval)
					{
						if (flag)
						{
							if (ticksInterval == 0x7fffffffffffffffL)
							{
								this.GetDateInterval((double)listArray[index][i - 1], (double)listArray[index][i], out monthsInteval, out ticksInterval);
							}
							else
							{
								long num10 = 0x7fffffffffffffffL;
								int num11 = 0;
								this.GetDateInterval((double)listArray[index][i - 1], (double)listArray[index][i], out num11, out num10);
								if ((num11 != monthsInteval) || (num10 != ticksInterval))
								{
									sameInterval = false;
								}
							}
						}
						else if ((minValue != num9) && (minValue != double.MinValue))
						{
							sameInterval = false;
						}
					}
					minValue = num9;
					if ((maxValue > num9) && (num9 != 0.0))
					{
						maxValue = num9;
						series2 = series3;
					}
				}
				index++;
			}
			this.diffIntervalAlignmentChecked = false;
			if ((checkSameInterval && !sameInterval) && (listArray.Length > 1))
			{
				bool flag3 = false;
				this.diffIntervalAlignmentChecked = true;
				int num12 = 0;
				foreach (ArrayList list in listArray)
				{
					for (int j = 0; (j < list.Count) && !flag3; j++)
					{
						double item = (double)list[j];
						for (int k = num12 + 1; (k < listArray.Length) && !flag3; k++)
						{
							if (((j < listArray[k].Count) && (((double)listArray[k][j]) == item)) || listArray[k].Contains(item))
							{
								flag3 = true;
								break;
							}
						}
					}
					num12++;
				}
				if (flag3)
				{
					sameInterval = true;
				}
			}
			if (maxValue == double.MaxValue)
			{
				maxValue = 1.0;
			}
			this.intervalSameSize = sameInterval;
			if (!isLogarithmic)
			{
				this.intervalData = maxValue;
				this._intervalSeries = series2;
				series = this._intervalSeries;
				this._intervalSeriesList = str;
				return this.intervalData;
			}
			this.intervalLogData = maxValue;
			this._intervalSeries = series2;
			series = this._intervalSeries;
			this._intervalSeriesList = str;
			return this.intervalLogData;
		}

		internal int GetRealYAngle()
		{
			int rotation = this.Area3DStyle.Rotation;
			if (this._reverseSeriesOrder && (this.Area3DStyle.Rotation >= 0))
			{
				rotation = this.Area3DStyle.Rotation - 180;
			}
			if (this._reverseSeriesOrder && (this.Area3DStyle.Rotation <= 0))
			{
				rotation = this.Area3DStyle.Rotation + 180;
			}
			return rotation;
		}

		internal List<Series> GetSeries()
		{
			var list = new List<Series>();
			foreach (var str in this._series)
				list.Add(base.Common.DataManager.Series[str]);
			return list;
		}

		internal int GetSeriesClusterIndex(Series series)
		{
			if (this.seriesClusters == null)
			{
				this.GetNumberOfClusters();
			}
			for (int i = 0; i < this.seriesClusters.Count; i++)
			{
				List<string> list = this.seriesClusters[i];
				foreach (string str in list)
				{
					if (str == series.Name)
					{
						if (this._reverseSeriesOrder)
						{
							i = (this.seriesClusters.Count - 1) - i;
						}
						return i;
					}
				}
			}
			return 0;
		}

		public float GetSeriesDepth(Series series)
		{
			float num;
			float num2;
			this.GetSeriesZPositionAndDepth(series, out num2, out num);
			return ((num2 / this.areaSceneDepth) * 100f);
		}

		private List<Series> GetSeriesDrawingOrder(bool reverseSeriesOrder)
		{
			var list = new List<Series>();
			foreach (List<string> list2 in this.seriesClusters)
			{
				if (list2.Count > 0)
				{
					var item = base.Common.DataManager.Series[list2[0]];
					list.Add(item);
				}
			}
			if (reverseSeriesOrder)
			{
				list.Reverse();
			}
			if (this.DrawSeriesToCenter() && this.matrix3D.IsInitialized())
			{
				Point3D centerOfProjection = new Point3D(float.NaN, float.NaN, float.NaN);
				centerOfProjection = this.GetCenterOfProjection(COPCoordinates.Z);
				if (float.IsNaN(centerOfProjection.Z))
				{
					return list;
				}
				for (int i = 0; i < list.Count; i++)
				{
					if (list[i].Points.Count != 0)
					{
						float num2;
						float num3;
						this.GetSeriesZPositionAndDepth(list[i], out num2, out num3);
						if (num3 >= centerOfProjection.Z)
						{
							i--;
							if (i < 0)
							{
								i = 0;
							}
							list.Reverse(i, list.Count - i);
							return list;
						}
					}
				}
			}
			return list;
		}

		internal List<string> GetSeriesFromChartType(string chartType)
		{
			List<string> list = new List<string>();
			foreach (string str in this._series)
			{
				if (string.Compare(chartType, base.Common.DataManager.Series[str].ChartTypeName, StringComparison.OrdinalIgnoreCase) == 0)
				{
					list.Add(str);
				}
			}
			return list;
		}

		internal int GetSeriesStackGroupIndex(Series series, ref string stackGroupName)
		{
			stackGroupName = string.Empty;
			if (this._stackGroupNames == null)
			{
				return 0;
			}
			if (series.IsCustomPropertySet("StackedGroupName"))
			{
				stackGroupName = series["StackedGroupName"];
			}
			return this._stackGroupNames.IndexOf(stackGroupName);
		}

		public float GetSeriesZPosition(Series series)
		{
			float num;
			float num2;
			this.GetSeriesZPositionAndDepth(series, out num2, out num);
			return (((num + (num2 / 2f)) / this.areaSceneDepth) * 100f);
		}

		internal void GetSeriesZPositionAndDepth(Series series, out float depth, out float positionZ)
		{
			if (series == null)
			{
				throw new ArgumentNullException("series");
			}
			int seriesClusterIndex = this.GetSeriesClusterIndex(series);
			depth = (float)this._pointsDepth;
			positionZ = (float)((this._pointsGapDepth / 2.0) + ((this._pointsDepth + this._pointsGapDepth) * seriesClusterIndex));
		}

		internal void GetTempValues()
		{
			this.axisX.ResetAxisValues();
			this.axisX2.ResetAxisValues();
			this.axisY.ResetAxisValues();
			this.axisY2.ResetAxisValues();
			if (!this.originalAreaPosition.IsEmpty)
			{
				this.lastAreaPosition = this.Position.ToRectangleF();
				this.Position.SetPositionNoAuto(this.originalAreaPosition.X, this.originalAreaPosition.Y, this.originalAreaPosition.Width, this.originalAreaPosition.Height);
				this.originalAreaPosition = RectangleF.Empty;
			}
			if (!this.originalInnerPlotPosition.IsEmpty)
			{
				this.InnerPlotPosition.SetPositionNoAuto(this.originalInnerPlotPosition.X, this.originalInnerPlotPosition.Y, this.originalInnerPlotPosition.Width, this.originalInnerPlotPosition.Height);
				this.originalInnerPlotPosition = RectangleF.Empty;
			}
		}

		private void GetValuesFromData(Axis axis, out double autoMinimum, out double autoMaximum)
		{
			int numberOfAllPoints = this.GetNumberOfAllPoints();
			if ((!axis.refreshMinMaxFromData && !double.IsNaN(axis.minimumFromData)) && (!double.IsNaN(axis.maximumFromData) && (axis.numberOfPointsInAllSeries == numberOfAllPoints)))
			{
				autoMinimum = axis.minimumFromData;
				autoMaximum = axis.maximumFromData;
				return;
			}
			AxisType primary = AxisType.Primary;
			if ((axis.axisType == AxisName.X2) || (axis.axisType == AxisName.Y2))
			{
				primary = AxisType.Secondary;
			}
			string[] strArray = this.GetXAxesSeries(primary, axis.SubAxisName).ToArray();
			string[] strArray2 = this.GetYAxesSeries(primary, axis.SubAxisName).ToArray();
			if ((axis.axisType == AxisName.X2) || (axis.axisType == AxisName.X))
			{
				if (this.stacked)
				{
					try
					{
						base.Common.DataManager.GetMinMaxXValue(out autoMinimum, out autoMaximum, strArray);
						goto Label_03CF;
					}
					catch (Exception)
					{
						throw new InvalidOperationException(SR.ExceptionAxisStackedChartsDataPointsNumberMismatch);
					}
				}
				if (this.secondYScale)
				{
					autoMaximum = base.Common.DataManager.GetMaxXWithRadiusValue(this, strArray);
					autoMinimum = base.Common.DataManager.GetMinXWithRadiusValue(this, strArray);
					ChartValueType xValueType = base.Common.DataManager.Series[strArray[0]].XValueType;
					if (((xValueType != ChartValueType.Date) && (xValueType != ChartValueType.DateTime)) && ((xValueType != ChartValueType.Time) && (xValueType != ChartValueType.DateTimeOffset)))
					{
						axis.roundedXValues = true;
					}
				}
				else
				{
					base.Common.DataManager.GetMinMaxXValue(out autoMinimum, out autoMaximum, strArray);
				}
			}
			else
			{
				if (this.stacked)
				{
					try
					{
						if (this.hundredPercent)
						{
							autoMaximum = base.Common.DataManager.GetMaxHundredPercentStackedYValue(this.hundredPercentNegative, strArray2);
							autoMinimum = base.Common.DataManager.GetMinHundredPercentStackedYValue(this.hundredPercentNegative, strArray2);
						}
						else
						{
							double minValue = double.MinValue;
							double maxValue = double.MaxValue;
							double num4 = double.MinValue;
							double num5 = double.MaxValue;
							foreach (string[] strArray3 in this.SplitSeriesInStackedGroups(strArray2))
							{
								double maxStackedYValue = base.Common.DataManager.GetMaxStackedYValue(0, strArray3);
								double minStackedYValue = base.Common.DataManager.GetMinStackedYValue(0, strArray3);
								double maxUnsignedStackedYValue = base.Common.DataManager.GetMaxUnsignedStackedYValue(0, strArray3);
								double minUnsignedStackedYValue = base.Common.DataManager.GetMinUnsignedStackedYValue(0, strArray3);
								minValue = Math.Max(minValue, maxStackedYValue);
								maxValue = Math.Min(maxValue, minStackedYValue);
								num4 = Math.Max(num4, maxUnsignedStackedYValue);
								num5 = Math.Min(num5, minUnsignedStackedYValue);
							}
							autoMaximum = Math.Max(minValue, num4);
							autoMinimum = Math.Min(maxValue, num5);
						}
						if (axis.IsLogarithmic && (autoMinimum < 1.0))
						{
							autoMinimum = 1.0;
						}
						goto Label_03CF;
					}
					catch (Exception)
					{
						throw new InvalidOperationException(SR.ExceptionAxisStackedChartsDataPointsNumberMismatch);
					}
				}
				if (this.secondYScale)
				{
					autoMaximum = base.Common.DataManager.GetMaxYWithRadiusValue(this, strArray2);
					autoMinimum = base.Common.DataManager.GetMinYWithRadiusValue(this, strArray2);
				}
				else
				{
					bool flag = false;
					if ((base.Common != null) && (base.Common.Chart != null))
					{
						foreach (var series in base.Common.Chart.Series)
						{
							if (series.ChartArea == this.Name)
							{
								IChartType chartType = base.Common.ChartTypeRegistry.GetChartType(series.ChartTypeName);
								if ((chartType != null) && chartType.ExtraYValuesConnectedToYAxis)
								{
									flag = true;
									break;
								}
							}
						}
					}
					if (flag)
					{
						base.Common.DataManager.GetMinMaxYValue(out autoMinimum, out autoMaximum, strArray2);
					}
					else
					{
						base.Common.DataManager.GetMinMaxYValue(0, out autoMinimum, out autoMaximum, strArray2);
					}
				}
			}
		Label_03CF:
			axis.maximumFromData = autoMaximum;
			axis.minimumFromData = autoMinimum;
			axis.refreshMinMaxFromData = false;
			axis.numberOfPointsInAllSeries = numberOfAllPoints;
		}

		internal List<string> GetXAxesSeries(AxisType type, string subAxisName)
		{
			List<string> list = new List<string>();
			if (this._series.Count == 0)
			{
				return list;
			}
			if (!this.IsSubAxesSupported && (subAxisName.Length > 0))
			{
				return list;
			}
			foreach (string str in this._series)
			{
				if (base.Common.DataManager.Series[str].XAxisType == type)
				{
					list.Add(str);
				}
			}
			if (list.Count != 0)
			{
				return list;
			}
			if (type == AxisType.Secondary)
			{
				return this.GetXAxesSeries(AxisType.Primary, string.Empty);
			}
			return this.GetXAxesSeries(AxisType.Secondary, string.Empty);
		}

		internal List<string> GetYAxesSeries(AxisType type, string subAxisName)
		{
			List<string> list = new List<string>();
			foreach (string str in this._series)
			{
				AxisType yAxisType = base.Common.DataManager.Series[str].YAxisType;
				if ((base.Common.DataManager.Series[str].ChartType == SeriesChartType.Radar) || (base.Common.DataManager.Series[str].ChartType == SeriesChartType.Polar))
				{
					yAxisType = AxisType.Primary;
				}
				if (yAxisType == type)
				{
					list.Add(str);
				}
			}
			if ((list.Count == 0) && (type == AxisType.Secondary))
			{
				return this.GetYAxesSeries(AxisType.Primary, string.Empty);
			}
			return list;
		}

		internal void Initialize()
		{
			this._area3DStyle = new ChartArea3DStyle(this);
			this.axisY = new Axis();
			this.axisX = new Axis();
			this.axisX2 = new Axis();
			this.axisY2 = new Axis();
			this.axisX.Initialize(this, AxisName.X);
			this.axisY.Initialize(this, AxisName.Y);
			this.axisX2.Initialize(this, AxisName.X2);
			this.axisY2.Initialize(this, AxisName.Y2);
			this._axisArray[0] = this.axisX;
			this._axisArray[1] = this.axisY;
			this._axisArray[2] = this.axisX2;
			this._axisArray[3] = this.axisY2;
			this._areaPosition = new ElementPosition(this);
			this._areaPosition.resetAreaAutoPosition = true;
			this._innerPlotPosition = new ElementPosition(this);
			if (this.PlotAreaPosition == null)
			{
				this.PlotAreaPosition = new ElementPosition(this);
			}
		}

		private bool IsBorderOnTopSeries()
		{
			foreach (var series in base.Common.Chart.Series)
			{
				if ((series.ChartArea == this.Name) && ((series.ChartType == SeriesChartType.Bubble) || (series.ChartType == SeriesChartType.Point)))
				{
					return false;
				}
			}
			return true;
		}

		internal bool IsBottomSceneWallVisible()
		{
			return (this.Area3DStyle.Inclination >= 0);
		}

		internal bool IsMainSceneWallOnFront()
		{
			return false;
		}

		internal bool IsSideSceneWallOnLeft()
		{
			return (this.Area3DStyle.Rotation > 0);
		}

		internal void Paint(ChartGraphics graph)
		{
			if (((this.PlotAreaPosition.Width == 0f) && (this.PlotAreaPosition.Height == 0f)) && (!this.InnerPlotPosition.Auto && !this.Position.Auto))
			{
				RectangleF rect = this.Position.ToRectangleF();
				if (!this.InnerPlotPosition.Auto)
				{
					rect.X += (this.Position.Width / 100f) * this.InnerPlotPosition.X;
					rect.Y += (this.Position.Height / 100f) * this.InnerPlotPosition.Y;
					rect.Width = (this.Position.Width / 100f) * this.InnerPlotPosition.Width;
					rect.Height = (this.Position.Height / 100f) * this.InnerPlotPosition.Height;
				}
				this.PlotAreaPosition.FromRectangleF(rect);
			}
			RectangleF backgroundPosition = this.GetBackgroundPosition(true);
			RectangleF rectArea = this.GetBackgroundPosition(false);
			if (base.Common.ProcessModeRegions)
			{
				base.Common.HotRegionsList.AddHotRegion(rectArea, this, ChartElementType.PlottingArea, true);
			}
			this.PaintAreaBack(graph, backgroundPosition, false);
			base.Common.Chart.CallOnPrePaint(new ChartPaintEventArgs(this, graph, base.Common, this.PlotAreaPosition));
			if (this.requireAxes || (this.ChartTypes.Count == 0))
			{
				this.smartLabels.Reset();
				foreach (Axis axis in this._axisArray)
				{
					axis.optimizedGetPosition = true;
					axis.paintViewMax = axis.ViewMaximum;
					axis.paintViewMin = axis.ViewMinimum;
					axis.paintRange = axis.paintViewMax - axis.paintViewMin;
					axis.paintAreaPosition = this.PlotAreaPosition.ToRectangleF();
					if ((axis.ChartArea != null) && axis.ChartArea.chartAreaIsCurcular)
					{
						axis.paintAreaPosition.Width /= 2f;
						axis.paintAreaPosition.Height /= 2f;
					}
					axis.paintAreaPositionBottom = axis.paintAreaPosition.Y + axis.paintAreaPosition.Height;
					axis.paintAreaPositionRight = axis.paintAreaPosition.X + axis.paintAreaPosition.Width;
					if ((axis.AxisPosition == AxisPosition.Top) || (axis.AxisPosition == AxisPosition.Bottom))
					{
						axis.paintChartAreaSize = axis.paintAreaPosition.Width;
					}
					else
					{
						axis.paintChartAreaSize = axis.paintAreaPosition.Height;
					}
					axis.valueMultiplier = 0.0;
					if (axis.paintRange != 0.0)
					{
						axis.valueMultiplier = axis.paintChartAreaSize / axis.paintRange;
					}
				}
				Axis[] axisArray = new Axis[] { this.axisY, this.axisY2, this.axisX, this.axisX2 };
				foreach (Axis axis2 in axisArray)
				{
					if (axis2.ScaleSegments.Count <= 0)
					{
						axis2.PaintStrips(graph, false);
					}
					else
					{
						foreach (AxisScaleSegment segment in axis2.ScaleSegments)
						{
							segment.SetTempAxisScaleAndInterval();
							axis2.PaintStrips(graph, false);
							segment.RestoreAxisScaleAndInterval();
						}
					}
				}
				axisArray = new Axis[] { this.axisY, this.axisX2, this.axisY2, this.axisX };
				foreach (Axis axis3 in axisArray)
				{
					if (axis3.ScaleSegments.Count <= 0)
					{
						axis3.PaintGrids(graph);
					}
					else
					{
						foreach (AxisScaleSegment segment2 in axis3.ScaleSegments)
						{
							segment2.SetTempAxisScaleAndInterval();
							axis3.PaintGrids(graph);
							segment2.RestoreAxisScaleAndInterval();
						}
					}
				}
				foreach (Axis axis4 in axisArray)
				{
					if (axis4.ScaleSegments.Count <= 0)
					{
						axis4.PaintStrips(graph, true);
					}
					else
					{
						foreach (AxisScaleSegment segment3 in axis4.ScaleSegments)
						{
							segment3.SetTempAxisScaleAndInterval();
							axis4.PaintStrips(graph, true);
							segment3.RestoreAxisScaleAndInterval();
						}
					}
				}
				if (this.Area3DStyle.Enable3D && !this.chartAreaIsCurcular)
				{
					foreach (Axis axis5 in axisArray)
					{
						if (axis5.ScaleSegments.Count <= 0)
						{
							axis5.PrePaint(graph);
						}
						else
						{
							foreach (AxisScaleSegment segment4 in axis5.ScaleSegments)
							{
								segment4.SetTempAxisScaleAndInterval();
								axis5.PrePaint(graph);
								segment4.RestoreAxisScaleAndInterval();
							}
						}
					}
				}
				bool flag2 = false;
				if (this.Area3DStyle.Enable3D || !this.IsBorderOnTopSeries())
				{
					flag2 = true;
					this.PaintAreaBack(graph, rectArea, true);
				}
				if (!this.Area3DStyle.Enable3D || this.chartAreaIsCurcular)
				{
					foreach (ChartTypeAndSeriesInfo info in this.GetChartTypesAndSeriesToDraw())
					{
						this.IterationCounter = 0;
						base.Common.ChartTypeRegistry.GetChartType(info.ChartType).Paint(graph, base.Common, this, info.Series);
					}
				}
				else
				{
					this.PaintChartSeries3D(graph);
				}
				if (!flag2)
				{
					this.PaintAreaBack(graph, rectArea, true);
				}
				foreach (Axis axis6 in axisArray)
				{
					if (axis6.ScaleSegments.Count <= 0)
					{
						axis6.Paint(graph);
					}
					else
					{
						foreach (AxisScaleSegment segment5 in axis6.ScaleSegments)
						{
							segment5.SetTempAxisScaleAndInterval();
							axis6.PaintOnSegmentedScalePassOne(graph);
							segment5.RestoreAxisScaleAndInterval();
						}
						axis6.PaintOnSegmentedScalePassTwo(graph);
					}
				}
				base.Common.Chart.CallOnPostPaint(new ChartPaintEventArgs(this, graph, base.Common, this.PlotAreaPosition));
				axisArray = new Axis[] { this.axisY, this.axisY2 };
				foreach (Axis axis7 in axisArray)
				{
					for (int i = 0; i < (axis7.ScaleSegments.Count - 1); i++)
					{
						axis7.ScaleSegments[i].PaintBreakLine(graph, axis7.ScaleSegments[i + 1]);
					}
				}
				foreach (Axis axis8 in this._axisArray)
				{
					axis8.optimizedGetPosition = false;
					axis8.prefferedNumberofIntervals = 5;
					axis8.scaleSegmentsUsed = false;
				}
			}
			else
			{
				for (int j = 0; j < this.ChartTypes.Count; j++)
				{
					IChartType chartType = base.Common.ChartTypeRegistry.GetChartType((string)this.ChartTypes[j]);
					if (!chartType.RequireAxes)
					{
						chartType.Paint(graph, base.Common, this, null);
						break;
					}
				}
				base.Common.Chart.CallOnPostPaint(new ChartPaintEventArgs(this, graph, base.Common, this.PlotAreaPosition));
			}
		}

		private void PaintAreaBack(ChartGraphics graph, RectangleF position, bool borderOnly)
		{
			if (!borderOnly)
			{
				if ((!this.Area3DStyle.Enable3D || !this.requireAxes) || this.chartAreaIsCurcular)
				{
					graph.FillRectangleRel(position, this.BackColor, this.BackHatchStyle, this.BackImage, this.BackImageWrapMode, this.BackImageTransparentColor, this.BackImageAlignment, this.BackGradientStyle, this.BackSecondaryColor, this.requireAxes ? Color.Empty : this.BorderColor, this.requireAxes ? 0 : this.BorderWidth, this.BorderDashStyle, this.ShadowColor, this.ShadowOffset, PenAlignment.Outset, this.chartAreaIsCurcular, (this.chartAreaIsCurcular && this.CircularUsePolygons) ? this.CircularSectorsNumber : 0, this.Area3DStyle.Enable3D);
				}
				else
				{
					this.DrawArea3DScene(graph, position);
				}
			}
			else if (((!this.Area3DStyle.Enable3D || !this.requireAxes) || this.chartAreaIsCurcular) && ((this.BorderColor != Color.Empty) && (this.BorderWidth > 0)))
			{
				graph.FillRectangleRel(position, Color.Transparent, ChartHatchStyle.None, "", ChartImageWrapMode.Tile, Color.Empty, ChartImageAlignmentStyle.Center, GradientStyle.None, Color.Empty, this.BorderColor, this.BorderWidth, this.BorderDashStyle, Color.Empty, 0, PenAlignment.Outset, this.chartAreaIsCurcular, (this.chartAreaIsCurcular && this.CircularUsePolygons) ? this.CircularSectorsNumber : 0, this.Area3DStyle.Enable3D);
			}
		}

		internal void PaintChartSeries3D(ChartGraphics graph)
		{
			var area = this;
			foreach (var obj2 in this.GetSeriesDrawingOrder(this._reverseSeriesOrder))
			{
				var seriesToDraw = obj2;
				base.Common.ChartTypeRegistry.GetChartType(seriesToDraw.ChartTypeName).Paint(graph, base.Common, area, seriesToDraw);
			}
		}

		internal void PaintCursors(ChartGraphics graph, bool cursorOnly)
		{
			if ((((!this.Area3DStyle.Enable3D && this.requireAxes) && !this.chartAreaIsCurcular) && (((base.Common == null) || (base.Common.ChartPicture == null)) || !base.Common.ChartPicture.isPrinting)) && (this.Position.Width != 0f))
			{
				float height = this.Position.Height;
			}
		}

		private void PreventTopBottomAxesLabelsOverlapping(Axis axis)
		{
			if (axis.IsAxisOnAreaEdge)
			{
				if (axis.AxisPosition == AxisPosition.Bottom)
				{
					float axisPosition = (float)axis.GetAxisPosition();
					if (!axis.GetIsMarksNextToAxis())
					{
						axisPosition = axis.PlotAreaPosition.Bottom;
					}
					if (Math.Round((double)axisPosition, 2) >= Math.Round((double)axis.PlotAreaPosition.Bottom, 2))
					{
						Axis axis2 = this.FindAxis(AxisPosition.Left);
						if ((((axis2 != null) && axis2.enabled) && ((axis2.labelFarOffset != 0f) && (axis2.labelFarOffset > axisPosition))) && ((axis.labelNearOffset != 0f) && (axis.labelNearOffset < this.PlotAreaPosition.X)))
						{
							float num2 = (axis2.labelFarOffset - axisPosition) * 0.75f;
							if (num2 > axis.markSize)
							{
								axis.markSize += num2 - axis.markSize;
							}
						}
						Axis axis3 = this.FindAxis(AxisPosition.Right);
						if ((((axis3 != null) && axis3.enabled) && ((axis3.labelFarOffset != 0f) && (axis3.labelFarOffset > axisPosition))) && ((axis.labelFarOffset != 0f) && (axis.labelFarOffset > this.PlotAreaPosition.Right)))
						{
							float num3 = (axis3.labelFarOffset - axisPosition) * 0.75f;
							if (num3 > axis.markSize)
							{
								axis.markSize += num3 - axis.markSize;
							}
						}
					}
				}
				else if (axis.AxisPosition == AxisPosition.Top)
				{
					float y = (float)axis.GetAxisPosition();
					if (!axis.GetIsMarksNextToAxis())
					{
						y = axis.PlotAreaPosition.Y;
					}
					if (Math.Round((double)y, 2) >= Math.Round((double)axis.PlotAreaPosition.Y, 2))
					{
						Axis axis4 = this.FindAxis(AxisPosition.Left);
						if ((((axis4 != null) && axis4.enabled) && ((axis4.labelNearOffset != 0f) && (axis4.labelNearOffset < y))) && ((axis.labelNearOffset != 0f) && (axis.labelNearOffset < this.PlotAreaPosition.X)))
						{
							float num5 = (y - axis4.labelNearOffset) * 0.75f;
							if (num5 > axis.markSize)
							{
								axis.markSize += num5 - axis.markSize;
							}
						}
						Axis axis5 = this.FindAxis(AxisPosition.Right);
						if ((((axis5 != null) && axis5.enabled) && ((axis5.labelNearOffset != 0f) && (axis5.labelNearOffset < y))) && ((axis.labelFarOffset != 0f) && (axis.labelFarOffset > this.PlotAreaPosition.Right)))
						{
							float num6 = (y - axis5.labelNearOffset) * 0.75f;
							if (num6 > axis.markSize)
							{
								axis.markSize += num6 - axis.markSize;
							}
						}
					}
				}
			}
		}

		internal void ReCalcInternal()
		{
			this._axisArray[0].ReCalc(this.PlotAreaPosition);
			this._axisArray[1].ReCalc(this.PlotAreaPosition);
			this._axisArray[2].ReCalc(this.PlotAreaPosition);
			this._axisArray[3].ReCalc(this.PlotAreaPosition);
			this.SetData();
		}

		public void RecalculateAxesScale()
		{
			this.ResetMinMaxFromData();
			this._axisArray[0].ReCalc(this.PlotAreaPosition);
			this._axisArray[1].ReCalc(this.PlotAreaPosition);
			this._axisArray[2].ReCalc(this.PlotAreaPosition);
			this._axisArray[3].ReCalc(this.PlotAreaPosition);
			this.SetData();
		}

		internal void ResetAutoValues()
		{
			this._axisArray[0].ResetAutoValues();
			this._axisArray[1].ResetAutoValues();
			this._axisArray[2].ResetAutoValues();
			this._axisArray[3].ResetAutoValues();
		}

		internal void ResetMinMaxFromData()
		{
			this._axisArray[0].refreshMinMaxFromData = true;
			this._axisArray[1].refreshMinMaxFromData = true;
			this._axisArray[2].refreshMinMaxFromData = true;
			this._axisArray[3].refreshMinMaxFromData = true;
		}

		internal void Resize(ChartGraphics chartGraph)
		{
			RectangleF plotArea = this.Position.ToRectangleF();
			if (!this.InnerPlotPosition.Auto)
			{
				plotArea.X += (this.Position.Width / 100f) * this.InnerPlotPosition.X;
				plotArea.Y += (this.Position.Height / 100f) * this.InnerPlotPosition.Y;
				plotArea.Width = (this.Position.Width / 100f) * this.InnerPlotPosition.Width;
				plotArea.Height = (this.Position.Height / 100f) * this.InnerPlotPosition.Height;
			}
			int num = 0;
			int num2 = 0;
			foreach (Axis axis in this.Axes)
			{
				if (axis.enabled)
				{
					if (axis.AxisPosition == AxisPosition.Bottom)
					{
						num2++;
					}
					else if (axis.AxisPosition == AxisPosition.Top)
					{
						num2++;
					}
					else if (axis.AxisPosition == AxisPosition.Left)
					{
						num++;
					}
					else if (axis.AxisPosition == AxisPosition.Right)
					{
						num++;
					}
				}
			}
			if (num2 <= 0)
			{
				num2 = 1;
			}
			if (num <= 0)
			{
				num = 1;
			}
			Axis[] axisArray = this.switchValueAxes ? new Axis[] { this.AxisX, this.AxisX2, this.AxisY, this.AxisY2 } : new Axis[] { this.AxisY, this.AxisY2, this.AxisX, this.AxisX2 };
			if (this.IsSameFontSizeForAllAxes)
			{
				this.axesAutoFontSize = 20f;
				foreach (Axis axis2 in axisArray)
				{
					if (axis2.enabled)
					{
						if ((axis2.AxisPosition == AxisPosition.Bottom) || (axis2.AxisPosition == AxisPosition.Top))
						{
							axis2.Resize(chartGraph, this.PlotAreaPosition, plotArea, (float)num2, this.InnerPlotPosition.Auto);
						}
						else
						{
							axis2.Resize(chartGraph, this.PlotAreaPosition, plotArea, (float)num, this.InnerPlotPosition.Auto);
						}
						if (axis2.IsLabelAutoFit && (axis2.autoLabelFont != null))
						{
							this.axesAutoFontSize = Math.Min(this.axesAutoFontSize, axis2.autoLabelFont.Size);
						}
					}
				}
			}
			RectangleF empty = RectangleF.Empty;
			foreach (Axis axis3 in axisArray)
			{
				if (!axis3.enabled)
				{
					if ((this.InnerPlotPosition.Auto && this.Area3DStyle.Enable3D) && !this.chartAreaIsCurcular)
					{
						SizeF relativeSize = chartGraph.GetRelativeSize(new SizeF((float)this.Area3DStyle.WallWidth, (float)this.Area3DStyle.WallWidth));
						if (axis3.AxisPosition == AxisPosition.Bottom)
						{
							plotArea.Height -= relativeSize.Height;
						}
						else if (axis3.AxisPosition == AxisPosition.Top)
						{
							plotArea.Y += relativeSize.Height;
							plotArea.Height -= relativeSize.Height;
						}
						else if (axis3.AxisPosition == AxisPosition.Right)
						{
							plotArea.Width -= relativeSize.Width;
						}
						else if (axis3.AxisPosition == AxisPosition.Left)
						{
							plotArea.X += relativeSize.Width;
							plotArea.Width -= relativeSize.Width;
						}
					}
				}
				else
				{
					if ((axis3.AxisPosition == AxisPosition.Bottom) || (axis3.AxisPosition == AxisPosition.Top))
					{
						axis3.Resize(chartGraph, this.PlotAreaPosition, plotArea, (float)num2, this.InnerPlotPosition.Auto);
					}
					else
					{
						axis3.Resize(chartGraph, this.PlotAreaPosition, plotArea, (float)num, this.InnerPlotPosition.Auto);
					}
					this.PreventTopBottomAxesLabelsOverlapping(axis3);
					float axisPosition = (float)axis3.GetAxisPosition();
					if (axis3.AxisPosition == AxisPosition.Bottom)
					{
						if (!axis3.GetIsMarksNextToAxis())
						{
							axisPosition = plotArea.Bottom;
						}
						axisPosition = plotArea.Bottom - axisPosition;
					}
					else if (axis3.AxisPosition == AxisPosition.Top)
					{
						if (!axis3.GetIsMarksNextToAxis())
						{
							axisPosition = plotArea.Y;
						}
						axisPosition -= plotArea.Top;
					}
					else if (axis3.AxisPosition == AxisPosition.Right)
					{
						if (!axis3.GetIsMarksNextToAxis())
						{
							axisPosition = plotArea.Right;
						}
						axisPosition = plotArea.Right - axisPosition;
					}
					else if (axis3.AxisPosition == AxisPosition.Left)
					{
						if (!axis3.GetIsMarksNextToAxis())
						{
							axisPosition = plotArea.X;
						}
						axisPosition -= plotArea.Left;
					}
					float num4 = axis3.markSize + axis3.labelSize;
					num4 -= axisPosition;
					if (num4 < 0f)
					{
						num4 = 0f;
					}
					num4 += axis3.titleSize + axis3.scrollBarSize;
					if (this.chartAreaIsCurcular && ((axis3.AxisPosition == AxisPosition.Top) || (axis3.AxisPosition == AxisPosition.Bottom)))
					{
						num4 = (axis3.titleSize + axis3.markSize) + axis3.scrollBarSize;
					}
					if (this.InnerPlotPosition.Auto)
					{
						if (axis3.AxisPosition == AxisPosition.Bottom)
						{
							plotArea.Height -= num4;
						}
						else if (axis3.AxisPosition == AxisPosition.Top)
						{
							plotArea.Y += num4;
							plotArea.Height -= num4;
						}
						else if (axis3.AxisPosition == AxisPosition.Left)
						{
							plotArea.X += num4;
							plotArea.Width -= num4;
						}
						else if (axis3.AxisPosition == AxisPosition.Right)
						{
							plotArea.Width -= num4;
						}
						if (true)
						{
							if ((axis3.AxisPosition == AxisPosition.Bottom) || (axis3.AxisPosition == AxisPosition.Top))
							{
								if ((axis3.labelNearOffset != 0f) && (axis3.labelNearOffset < this.Position.X))
								{
									float num5 = this.Position.X - axis3.labelNearOffset;
									if (Math.Abs(num5) > (plotArea.Width * 0.3f))
									{
										num5 = plotArea.Width * 0.3f;
									}
									empty.X = Math.Max(num5, empty.X);
								}
								if (axis3.labelFarOffset > this.Position.Right)
								{
									if ((axis3.labelFarOffset - this.Position.Right) < (plotArea.Width * 0.3f))
									{
										empty.Width = Math.Max(axis3.labelFarOffset - this.Position.Right, empty.Width);
									}
									else
									{
										empty.Width = Math.Max(plotArea.Width * 0.3f, empty.Width);
									}
								}
							}
							else
							{
								if ((axis3.labelNearOffset != 0f) && (axis3.labelNearOffset < this.Position.Y))
								{
									float num6 = this.Position.Y - axis3.labelNearOffset;
									if (Math.Abs(num6) > (plotArea.Height * 0.3f))
									{
										num6 = plotArea.Height * 0.3f;
									}
									empty.Y = Math.Max(num6, empty.Y);
								}
								if (axis3.labelFarOffset > this.Position.Bottom)
								{
									if ((axis3.labelFarOffset - this.Position.Bottom) < (plotArea.Height * 0.3f))
									{
										empty.Height = Math.Max(axis3.labelFarOffset - this.Position.Bottom, empty.Height);
									}
									else
									{
										empty.Height = Math.Max(plotArea.Height * 0.3f, empty.Height);
									}
								}
							}
						}
					}
				}
			}
			if (!this.chartAreaIsCurcular)
			{
				if ((empty.Y > 0f) && (empty.Y > (plotArea.Y - this.Position.Y)))
				{
					float num7 = (plotArea.Y - this.Position.Y) - empty.Y;
					plotArea.Y -= num7;
					plotArea.Height += num7;
				}
				if ((empty.X > 0f) && (empty.X > (plotArea.X - this.Position.X)))
				{
					float num8 = (plotArea.X - this.Position.X) - empty.X;
					plotArea.X -= num8;
					plotArea.Width += num8;
				}
				if ((empty.Height > 0f) && (empty.Height > (this.Position.Bottom - plotArea.Bottom)))
				{
					plotArea.Height += (this.Position.Bottom - plotArea.Bottom) - empty.Height;
				}
				if ((empty.Width > 0f) && (empty.Width > (this.Position.Right - plotArea.Right)))
				{
					plotArea.Width += (this.Position.Right - plotArea.Right) - empty.Width;
				}
			}
			if (this.chartAreaIsCurcular)
			{
				float xTitleSize = Math.Max(this.AxisY.titleSize, this.AxisY2.titleSize);
				if (xTitleSize > 0f)
				{
					plotArea.X += xTitleSize;
					plotArea.Width -= 2f * xTitleSize;
				}
				float yTitleSize = Math.Max(this.AxisX.titleSize, this.AxisX2.titleSize);
				if (yTitleSize > 0f)
				{
					plotArea.Y += yTitleSize;
					plotArea.Height -= 2f * yTitleSize;
				}
				RectangleF absoluteRectangle = chartGraph.GetAbsoluteRectangle(plotArea);
				if (absoluteRectangle.Width > absoluteRectangle.Height)
				{
					absoluteRectangle.X += (absoluteRectangle.Width - absoluteRectangle.Height) / 2f;
					absoluteRectangle.Width = absoluteRectangle.Height;
				}
				else
				{
					absoluteRectangle.Y += (absoluteRectangle.Height - absoluteRectangle.Width) / 2f;
					absoluteRectangle.Height = absoluteRectangle.Width;
				}
				plotArea = chartGraph.GetRelativeRectangle(absoluteRectangle);
				this.circularCenter = new PointF(plotArea.X + (plotArea.Width / 2f), plotArea.Y + (plotArea.Height / 2f));
				this.FitCircularLabels(chartGraph, this.PlotAreaPosition, ref plotArea, xTitleSize, yTitleSize);
			}
			if (plotArea.Width < 0f)
			{
				plotArea.Width = 0f;
			}
			if (plotArea.Height < 0f)
			{
				plotArea.Height = 0f;
			}
			this.PlotAreaPosition.FromRectangleF(plotArea);
			this.InnerPlotPosition.SetPositionNoAuto((float)Math.Round((double)((plotArea.X - this.Position.X) / (this.Position.Width / 100f)), 5), (float)Math.Round((double)((plotArea.Y - this.Position.Y) / (this.Position.Height / 100f)), 5), (float)Math.Round((double)(plotArea.Width / (this.Position.Width / 100f)), 5), (float)Math.Round((double)(plotArea.Height / (this.Position.Height / 100f)), 5));
			this.AxisY2.AdjustLabelFontAtSecondPass(chartGraph, this.InnerPlotPosition.Auto);
			this.AxisY.AdjustLabelFontAtSecondPass(chartGraph, this.InnerPlotPosition.Auto);
			if (this.InnerPlotPosition.Auto)
			{
				this.AxisX2.AdjustLabelFontAtSecondPass(chartGraph, this.InnerPlotPosition.Auto);
				this.AxisX.AdjustLabelFontAtSecondPass(chartGraph, this.InnerPlotPosition.Auto);
			}
		}

		internal void Restore3DAnglesAndReverseMode()
		{
			if (this.Area3DStyle.Enable3D && !this.chartAreaIsCurcular)
			{
				this.AxisX.IsReversed = this.oldReverseX;
				this.AxisX2.IsReversed = this.oldReverseX;
				this.AxisY.IsReversed = this.oldReverseY;
				this.AxisY2.IsReversed = this.oldReverseY;
				this.Area3DStyle.Rotation = this.oldYAngle;
			}
		}

		internal bool SeriesDateTimeType(AxisName axisName, string subAxisName)
		{
			foreach (var str in this._series)
			{
				var series = base.Common.DataManager.Series[str];
				if (axisName == AxisName.X)
				{
					if (series.XAxisType == AxisType.Primary)
					{
						if (((series.XValueType != ChartValueType.Date) && (series.XValueType != ChartValueType.DateTime)) && ((series.XValueType != ChartValueType.Time) && (series.XValueType != ChartValueType.DateTimeOffset)))
						{
							return false;
						}
						return true;
					}
					continue;
				}
				if (axisName == AxisName.X2)
				{
					if (series.XAxisType == AxisType.Secondary)
					{
						if (((series.XValueType != ChartValueType.Date) && (series.XValueType != ChartValueType.DateTime)) && ((series.XValueType != ChartValueType.Time) && (series.XValueType != ChartValueType.DateTimeOffset)))
						{
							return false;
						}
						return true;
					}
					continue;
				}
				if (axisName == AxisName.Y)
				{
					if (series.YAxisType == AxisType.Primary)
					{
						if (((series.YValueType != ChartValueType.Date) && (series.YValueType != ChartValueType.DateTime)) && ((series.YValueType != ChartValueType.Time) && (series.YValueType != ChartValueType.DateTimeOffset)))
						{
							return false;
						}
						return true;
					}
					continue;
				}
				if ((axisName == AxisName.Y2) && (series.YAxisType == AxisType.Secondary))
				{
					if (((series.YValueType != ChartValueType.Date) && (series.YValueType != ChartValueType.DateTime)) && ((series.YValueType != ChartValueType.Time) && (series.YValueType != ChartValueType.DateTimeOffset)))
					{
						return false;
					}
					return true;
				}
			}
			return false;
		}

		internal bool SeriesIntegerType(AxisName axisName, string subAxisName)
		{
			foreach (var str in this._series)
			{
				var series = base.Common.DataManager.Series[str];
				if (axisName == AxisName.X)
				{
					if (series.XAxisType == AxisType.Primary)
					{
						if (((series.XValueType != ChartValueType.Int32) && (series.XValueType != ChartValueType.UInt32)) && ((series.XValueType != ChartValueType.UInt64) && (series.XValueType != ChartValueType.Int64)))
						{
							return false;
						}
						return true;
					}
					continue;
				}
				if (axisName == AxisName.X2)
				{
					if (series.XAxisType == AxisType.Secondary)
					{
						if (((series.XValueType != ChartValueType.Int32) && (series.XValueType != ChartValueType.UInt32)) && ((series.XValueType != ChartValueType.UInt64) && (series.XValueType != ChartValueType.Int64)))
						{
							return false;
						}
						return true;
					}
					continue;
				}
				if (axisName == AxisName.Y)
				{
					if (series.YAxisType == AxisType.Primary)
					{
						if (((series.YValueType != ChartValueType.Int32) && (series.YValueType != ChartValueType.UInt32)) && ((series.YValueType != ChartValueType.UInt64) && (series.YValueType != ChartValueType.Int64)))
						{
							return false;
						}
						return true;
					}
					continue;
				}
				if ((axisName == AxisName.Y2) && (series.YAxisType == AxisType.Secondary))
				{
					if (((series.YValueType != ChartValueType.Int32) && (series.YValueType != ChartValueType.UInt32)) && ((series.YValueType != ChartValueType.UInt64) && (series.YValueType != ChartValueType.Int64)))
					{
						return false;
					}
					return true;
				}
			}
			return false;
		}

		internal void Set3DAnglesAndReverseMode()
		{
			this._reverseSeriesOrder = false;
			if (this.Area3DStyle.Enable3D)
			{
				this.AxisX2.IsReversed = this.AxisX.IsReversed;
				this.AxisY2.IsReversed = this.AxisY.IsReversed;
				this.oldReverseX = this.AxisX.IsReversed;
				this.oldReverseY = this.AxisY.IsReversed;
				this.oldYAngle = this.Area3DStyle.Rotation;
				if ((this.Area3DStyle.Rotation > 90) || (this.Area3DStyle.Rotation < -90))
				{
					this.SetData(false, false);
					this._reverseSeriesOrder = true;
					if (!this.switchValueAxes)
					{
						this.AxisX.IsReversed = !this.AxisX.IsReversed;
						this.AxisX2.IsReversed = !this.AxisX2.IsReversed;
					}
					else
					{
						this.AxisY.IsReversed = !this.AxisY.IsReversed;
						this.AxisY2.IsReversed = !this.AxisY2.IsReversed;
					}
					if (this.Area3DStyle.Rotation > 90)
					{
						this.Area3DStyle.Rotation = (this.Area3DStyle.Rotation - 90) - 90;
					}
					else if (this.Area3DStyle.Rotation < -90)
					{
						this.Area3DStyle.Rotation = (this.Area3DStyle.Rotation + 90) + 90;
					}
				}
			}
		}

		internal void SetData()
		{
			this.SetData(true, true);
		}

		internal void SetData(bool initializeAxes, bool checkIndexedAligned)
		{
			this.stacked = false;
			this.switchValueAxes = false;
			this.requireAxes = true;
			this.hundredPercent = false;
			this.hundredPercentNegative = false;
			this.chartAreaIsCurcular = false;
			this.secondYScale = false;
			bool flag = false;
			this._series.Clear();
			foreach (var series in base.Common.DataManager.Series)
			{
				if (((series.ChartArea == this.Name) && series.IsVisible()) && (series.Points.Count > 0))
				{
					this._series.Add(series.Name);
				}
			}
			this.chartTypes.Clear();
			foreach (var series2 in base.Common.DataManager.Series)
			{
				bool flag2 = false;
				if (series2.IsVisible() && (series2.ChartArea == this.Name))
				{
					foreach (string str in this.chartTypes)
					{
						if (str == series2.ChartTypeName)
						{
							flag2 = true;
						}
					}
					if (!flag2)
					{
						if (base.Common.ChartTypeRegistry.GetChartType(series2.ChartTypeName).Stacked)
						{
							this.stacked = true;
						}
						if (!flag)
						{
							if (base.Common.ChartTypeRegistry.GetChartType(series2.ChartTypeName).SwitchValueAxes)
							{
								this.switchValueAxes = true;
							}
							if (!base.Common.ChartTypeRegistry.GetChartType(series2.ChartTypeName).RequireAxes)
							{
								this.requireAxes = false;
							}
							if (base.Common.ChartTypeRegistry.GetChartType(series2.ChartTypeName).CircularChartArea)
							{
								this.chartAreaIsCurcular = true;
							}
							if (base.Common.ChartTypeRegistry.GetChartType(series2.ChartTypeName).HundredPercent)
							{
								this.hundredPercent = true;
							}
							if (base.Common.ChartTypeRegistry.GetChartType(series2.ChartTypeName).HundredPercentSupportNegative)
							{
								this.hundredPercentNegative = true;
							}
							if (base.Common.ChartTypeRegistry.GetChartType(series2.ChartTypeName).SecondYScale)
							{
								this.secondYScale = true;
							}
							flag = true;
						}
						else if (base.Common.ChartTypeRegistry.GetChartType(series2.ChartTypeName).SwitchValueAxes != this.switchValueAxes)
						{
							throw new InvalidOperationException(SR.ExceptionChartAreaChartTypesCanNotCombine);
						}
						if (base.Common.DataManager.GetNumberOfPoints(new string[] { series2.Name }) != 0)
						{
							this.chartTypes.Add(series2.ChartTypeName);
						}
					}
				}
			}
			if (checkIndexedAligned)
			{
				for (int i = 0; i <= 1; i++)
				{
					List<string> xAxesSeries = this.GetXAxesSeries((i == 0) ? AxisType.Primary : AxisType.Secondary, string.Empty);
					if (xAxesSeries.Count > 0)
					{
						bool flag3 = false;
						string str2 = "";
						foreach (string str3 in xAxesSeries)
						{
							str2 = str2 + str3.Replace(",", @"\,") + ",";
							if (base.Common.DataManager.Series[str3].IsXValueIndexed)
							{
								flag3 = true;
							}
						}
						if (flag3)
						{
							try
							{
								base.Common.DataManipulator.CheckXValuesAlignment(base.Common.DataManipulator.ConvertToSeriesArray(str2.TrimEnd(new char[] { ',' }), false));
							}
							catch (Exception exception)
							{
								throw new ArgumentException(SR.ExceptionAxisSeriesNotAligned + exception.Message);
							}
						}
					}
				}
			}
			if (initializeAxes)
			{
				this.SetDefaultAxesValues();
			}
		}

		internal void SetDefaultAxesValues()
		{
			if (this.switchValueAxes)
			{
				this.axisY.AxisPosition = AxisPosition.Bottom;
				this.axisX.AxisPosition = AxisPosition.Left;
				this.axisX2.AxisPosition = AxisPosition.Right;
				this.axisY2.AxisPosition = AxisPosition.Top;
			}
			else
			{
				this.axisY.AxisPosition = AxisPosition.Left;
				this.axisX.AxisPosition = AxisPosition.Bottom;
				this.axisX2.AxisPosition = AxisPosition.Top;
				this.axisY2.AxisPosition = AxisPosition.Right;
			}
			foreach (Axis axis in this.Axes)
			{
				axis.oppositeAxis = null;
			}
			if (this.chartAreaIsCurcular)
			{
				this.axisX.SetAutoMaximum(360.0);
				this.axisX.SetAutoMinimum(0.0);
				this.axisX.SetInterval = Math.Abs((double)(this.axisX.maximum - this.axisX.minimum)) / 12.0;
			}
			else
			{
				this.SetDefaultFromIndexesOrData(this.axisX, AxisType.Primary);
			}
			this.SetDefaultFromIndexesOrData(this.axisX2, AxisType.Secondary);
			if (this.GetYAxesSeries(AxisType.Primary, string.Empty).Count != 0)
			{
				this.SetDefaultFromData(this.axisY);
				this.axisY.EstimateAxis();
			}
			if (this.GetYAxesSeries(AxisType.Secondary, string.Empty).Count != 0)
			{
				this.SetDefaultFromData(this.axisY2);
				this.axisY2.EstimateAxis();
			}
			this.axisX.SetAxisPosition();
			this.axisX2.SetAxisPosition();
			this.axisY.SetAxisPosition();
			this.axisY2.SetAxisPosition();
			this.EnableAxes();
			Axis[] axisArray = new Axis[] { this.axisY, this.axisY2 };
			foreach (Axis axis2 in axisArray)
			{
				axis2.ScaleBreakStyle.GetAxisSegmentForScaleBreaks(axis2.ScaleSegments);
				if (axis2.ScaleSegments.Count > 0)
				{
					axis2.scaleSegmentsUsed = true;
					if (axis2.minimum < axis2.ScaleSegments[0].ScaleMinimum)
					{
						axis2.minimum = axis2.ScaleSegments[0].ScaleMinimum;
					}
					if (axis2.minimum > axis2.ScaleSegments[axis2.ScaleSegments.Count - 1].ScaleMaximum)
					{
						axis2.minimum = axis2.ScaleSegments[axis2.ScaleSegments.Count - 1].ScaleMaximum;
					}
				}
			}
			Axis[] axisArray2 = new Axis[] { this.axisX, this.axisX2, this.axisY, this.axisY2 };
			foreach (Axis axis3 in axisArray2)
			{
				if (axis3.ScaleSegments.Count <= 0)
				{
					axis3.FillLabels(true);
				}
				else
				{
					bool removeFirstRow = true;
					int num = 0;
					foreach (AxisScaleSegment segment in axis3.ScaleSegments)
					{
						segment.SetTempAxisScaleAndInterval();
						axis3.FillLabels(removeFirstRow);
						removeFirstRow = false;
						segment.RestoreAxisScaleAndInterval();
						if ((num < (axis3.ScaleSegments.Count - 1)) && (axis3.CustomLabels.Count > 0))
						{
							axis3.CustomLabels.RemoveAt(axis3.CustomLabels.Count - 1);
						}
						num++;
					}
				}
			}
			foreach (Axis axis4 in axisArray2)
			{
				axis4.PostFillLabels();
			}
		}

		private void SetDefaultFromData(Axis axis)
		{
			double num;
			double num2;
			if ((!double.IsNaN(axis.ScaleView.Position) && !double.IsNaN(axis.ScaleView.Size)) && (!axis.refreshMinMaxFromData && axis.IsLogarithmic))
				return;

			this.GetValuesFromData(axis, out num2, out num);
			if (axis.enabled && (axis.AutoMaximum || double.IsNaN(axis.Maximum)))
			{
				if (num == double.MaxValue || num == double.MinValue)
					goto Label_00A2;
			}
			if ((!axis.AutoMinimum && !double.IsNaN(axis.Minimum)) || ((num2 != double.MaxValue) && (num2 != double.MinValue)))
			{
				goto Label_00DD;
			}
		Label_00A2:
			if (this.AllEmptyPoints())
			{
				num = 8.0;
				num2 = 1.0;
			}
			else if (!base.Common.ChartPicture.SuppressExceptions)
			{
				throw new InvalidOperationException(SR.ExceptionAxisMinimumMaximumInvalid);
			}
		Label_00DD:
			axis.marginView = 0.0;
			if ((axis.margin == 100.0) && ((axis.axisType == AxisName.X) || (axis.axisType == AxisName.X2)))
			{
				axis.marginView = this.GetPointsInterval(false, 10.0);
			}
			if ((num == num2) && (axis.Maximum == axis.Minimum))
			{
				axis.marginView = 1.0;
			}
			if (axis.IsLogarithmic)
			{
				axis.marginView = 0.0;
			}
			if (axis.AutoMaximum)
			{
				if (!axis.roundedXValues && ((axis.axisType == AxisName.X) || (axis.axisType == AxisName.X2)))
				{
					axis.SetAutoMaximum(num + axis.marginView);
				}
				else if (axis.isStartedFromZero && (num < 0.0))
				{
					axis.SetAutoMaximum(0.0);
				}
				else
				{
					axis.SetAutoMaximum(num);
				}
			}
			if (axis.AutoMinimum)
			{
				if (axis.IsLogarithmic)
				{
					if (num2 < 1.0)
					{
						axis.SetAutoMinimum(num2);
					}
					else if (axis.isStartedFromZero)
					{
						axis.SetAutoMinimum(1.0);
					}
					else
					{
						axis.SetAutoMinimum(num2);
					}
				}
				else if (num2 > 0.0)
				{
					if (!axis.roundedXValues && ((axis.axisType == AxisName.X) || (axis.axisType == AxisName.X2)))
					{
						axis.SetAutoMinimum(num2 - axis.marginView);
					}
					else if (axis.isStartedFromZero && !this.SeriesDateTimeType(axis.axisType, axis.SubAxisName))
					{
						axis.SetAutoMinimum(0.0);
					}
					else
					{
						axis.SetAutoMinimum(num2);
					}
				}
				else if ((axis.axisType == AxisName.X) || (axis.axisType == AxisName.X2))
				{
					axis.SetAutoMinimum(num2 - axis.marginView);
				}
				else
				{
					axis.SetAutoMinimum(num2);
				}
			}
			if (axis.IsLogarithmic && axis.logarithmicConvertedToLinear)
			{
				if (!axis.AutoMinimum)
				{
					axis.minimum = axis.logarithmicMinimum;
				}
				if (!axis.AutoMaximum)
				{
					axis.maximum = axis.logarithmicMaximum;
				}
				axis.logarithmicConvertedToLinear = false;
			}
			if (base.Common.ChartPicture.SuppressExceptions && (axis.maximum == axis.minimum))
			{
				axis.minimum = axis.maximum;
				axis.maximum = axis.minimum + 1.0;
			}
		}

		private void SetDefaultFromIndexes(Axis axis)
		{
			double num3;
			axis.SetTempAxisOffset();
			AxisType primary = AxisType.Primary;
			if ((axis.axisType == AxisName.X2) || (axis.axisType == AxisName.Y2))
			{
				primary = AxisType.Secondary;
			}
			double numberOfPoints = base.Common.DataManager.GetNumberOfPoints(this.GetXAxesSeries(primary, axis.SubAxisName).ToArray());
			double min = 0.0;
			axis.marginView = 0.0;
			if (axis.margin == 100.0)
			{
				axis.marginView = 1.0;
			}
			if ((numberOfPoints + (axis.margin / 100.0)) == ((min - (axis.margin / 100.0)) + 1.0))
			{
				axis.SetAutoMaximum(numberOfPoints + 1.0);
				axis.SetAutoMinimum(min);
			}
			else
			{
				axis.SetAutoMaximum(numberOfPoints + (axis.margin / 100.0));
				axis.SetAutoMinimum((min - (axis.margin / 100.0)) + 1.0);
			}
			if ((axis.ViewMaximum - axis.ViewMinimum) <= 10.0)
			{
				num3 = 1.0;
			}
			else
			{
				num3 = axis.CalcInterval((axis.ViewMaximum - axis.ViewMinimum) / 5.0);
			}
			ChartArea area = this;
			if (area.Area3DStyle.Enable3D && !double.IsNaN(axis.interval3DCorrection))
			{
				num3 = Math.Ceiling((double)(num3 / axis.interval3DCorrection));
				axis.interval3DCorrection = double.NaN;
				if (((num3 > 1.0) && (num3 < 4.0)) && ((axis.ViewMaximum - axis.ViewMinimum) <= 4.0))
				{
					num3 = 1.0;
				}
			}
			axis.SetInterval = num3;
			if (axis.offsetTempSet)
			{
				axis.minorGrid.intervalOffset -= axis.MajorGrid.GetInterval();
				axis.minorTickMark.intervalOffset -= axis.MajorTickMark.GetInterval();
			}
		}

		private void SetDefaultFromIndexesOrData(Axis axis, AxisType axisType)
		{
			var xAxesSeries = this.GetXAxesSeries(axisType, axis.SubAxisName);
			var flag = true;
			foreach (var str in xAxesSeries)
			{
				var series = base.Common.DataManager.Series[str];
				if (!ChartHelper.IndexedSeries(series))
				{
					flag = false;
					break;
				}
			}
			if (flag)
			{
				if (axis.IsLogarithmic)
					throw new InvalidOperationException(SR.ExceptionChartAreaAxisScaleLogarithmicUnsuitable);
				this.SetDefaultFromIndexes(axis);
			}
			else
			{
				this.SetDefaultFromData(axis);
				axis.EstimateAxis();
			}
		}

		internal void SetTempValues()
		{
			if (!this.Position.Auto)
			{
				this.originalAreaPosition = this.Position.ToRectangleF();
			}
			if (!this.InnerPlotPosition.Auto)
			{
				this.originalInnerPlotPosition = this.InnerPlotPosition.ToRectangleF();
			}
			this._circularSectorNumber = -2147483648;
			this._circularUsePolygons = -2147483648;
			this._circularAxisList = null;
			this.axisX.StoreAxisValues();
			this.axisX2.StoreAxisValues();
			this.axisY.StoreAxisValues();
			this.axisY2.StoreAxisValues();
		}

		internal bool ShouldDrawOnSurface(SurfaceNames surfaceName, bool backLayer, bool onEdge)
		{
			bool flag = (this._visibleSurfaces & surfaceName) == surfaceName;
			if (onEdge)
			{
				return backLayer;
			}
			return (backLayer == !flag);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		internal bool ShouldSerializeAxes()
		{
			return false;
		}

		internal bool ShouldSerializeInnerPlotPosition()
		{
			return !this.InnerPlotPosition.Auto;
		}

		internal bool ShouldSerializePosition()
		{
			return !this.Position.Auto;
		}

		private ArrayList SplitSeriesInStackedGroups(string[] seriesNames)
		{
			var hashtable = new Hashtable();
			foreach (var str in seriesNames)
			{
				var series = base.Common.Chart.Series[str];
				string key = string.Empty;
				if (StackedColumnChart.IsSeriesStackGroupNameSupported(series))
					key = StackedColumnChart.GetSeriesStackGroupName(series);
				if (hashtable.ContainsKey(key))
				{
					((ArrayList)hashtable[key]).Add(str);
				}
				else
				{
					ArrayList list2 = new ArrayList();
					list2.Add(str);
					hashtable.Add(key, list2);
				}
			}
			ArrayList list3 = new ArrayList();
			foreach (DictionaryEntry entry in hashtable)
			{
				ArrayList list4 = (ArrayList)entry.Value;
				if (list4.Count > 0)
				{
					int num = 0;
					string[] strArray = new string[list4.Count];
					foreach (string str3 in list4)
					{
						strArray[num++] = str3;
					}
					list3.Add(strArray);
				}
			}
			return list3;
		}

		public void TransformPoints(Point3D[] points)
		{
			foreach (Point3D pointd in points)
			{
				pointd.Z = (pointd.Z / 100f) * this.areaSceneDepth;
			}
			this.matrix3D.TransformPoints(points);
		}

		[Bindable(true), Editor(typeof(FlagsEnumUITypeEditor), typeof(UITypeEditor)), PersistenceMode(PersistenceMode.Attribute), DefaultValue(1), SRDescription("DescriptionAttributeChartArea_AlignOrientation"), SRCategory("CategoryAttributeAlignment")]
		public AreaAlignmentOrientations AlignmentOrientation
		{
			get
			{
				return this._alignmentOrientation;
			}
			set
			{
				this._alignmentOrientation = value;
				this.Invalidate();
			}
		}

		[PersistenceMode(PersistenceMode.Attribute), Editor(typeof(FlagsEnumUITypeEditor), typeof(UITypeEditor)), SRCategory("CategoryAttributeAlignment"), Bindable(true), DefaultValue(7), SRDescription("DescriptionAttributeChartArea_AlignType")]
		public AreaAlignmentStyles AlignmentStyle
		{
			get
			{
				return this._alignmentStyle;
			}
			set
			{
				this._alignmentStyle = value;
				this.Invalidate();
			}
		}

		[DefaultValue("NotSet"), PersistenceMode(PersistenceMode.Attribute), Bindable(true), SRCategory("CategoryAttributeAlignment"), SRDescription("DescriptionAttributeChartArea_AlignWithChartArea"), TypeConverter(typeof(LegendAreaNameConverter))]
		public string AlignWithChartArea
		{
			get
			{
				return this._alignWithChartArea;
			}
			set
			{
				if (value != this._alignWithChartArea)
				{
					if (string.IsNullOrEmpty(value))
					{
						this._alignWithChartArea = "NotSet";
					}
					else
					{
						if ((base.Chart != null) && (base.Chart.ChartAreas != null))
						{
							base.Chart.ChartAreas.VerifyNameReference(value);
						}
						this._alignWithChartArea = value;
					}
					this.Invalidate();
				}
			}
		}

		[TypeConverter(typeof(NoNameExpandableObjectConverter)), SRCategory("CategoryAttribute3D"), PersistenceMode(PersistenceMode.InnerProperty), Bindable(true), DefaultValue((string)null), SRDescription("DescriptionAttributeArea3DStyle"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
		public ChartArea3DStyle Area3DStyle
		{
			get
			{
				return this._area3DStyle;
			}
			set
			{
				this._area3DStyle = value;
				this._area3DStyle.Initialize(this);
			}
		}

		[Editor(typeof(AxesArrayEditor), typeof(UITypeEditor)), SRCategory("CategoryAttributeAxes"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), SerializationVisibility(SerializationVisibility.Hidden), SRDescription("DescriptionAttributeChartArea_Axes"), TypeConverter(typeof(AxesArrayConverter)), Bindable(true)]
		public Axis[] Axes
		{
			get
			{
				return this._axisArray;
			}
			set
			{
				this.AxisX = value[0];
				this.AxisY = value[1];
				this.AxisX2 = value[2];
				this.AxisY2 = value[3];
				this.Invalidate();
			}
		}

		[Browsable(false), SRDescription("DescriptionAttributeChartArea_AxisX"), TypeConverter(typeof(NoNameExpandableObjectConverter)), SRCategory("CategoryAttributeAxis"), Bindable(true), PersistenceMode(PersistenceMode.InnerProperty)]
		public Axis AxisX
		{
			get
			{
				return this.axisX;
			}
			set
			{
				this.axisX = value;
				this.axisX.Initialize(this, AxisName.X);
				this._axisArray[0] = this.axisX;
				this.Invalidate();
			}
		}

		[PersistenceMode(PersistenceMode.InnerProperty), TypeConverter(typeof(NoNameExpandableObjectConverter)), Bindable(true), Browsable(false), SRDescription("DescriptionAttributeChartArea_AxisX2"), SRCategory("CategoryAttributeAxis")]
		public Axis AxisX2
		{
			get
			{
				return this.axisX2;
			}
			set
			{
				this.axisX2 = value;
				this.axisX2.Initialize(this, AxisName.X2);
				this._axisArray[2] = this.axisX2;
				this.Invalidate();
			}
		}

		[TypeConverter(typeof(NoNameExpandableObjectConverter)), PersistenceMode(PersistenceMode.InnerProperty), SRCategory("CategoryAttributeAxis"), Bindable(true), Browsable(false), SRDescription("DescriptionAttributeChartArea_AxisY")]
		public Axis AxisY
		{
			get
			{
				return this.axisY;
			}
			set
			{
				this.axisY = value;
				this.axisY.Initialize(this, AxisName.Y);
				this._axisArray[1] = this.axisY;
				this.Invalidate();
			}
		}

		[TypeConverter(typeof(NoNameExpandableObjectConverter)), Bindable(true), Browsable(false), SRDescription("DescriptionAttributeChartArea_AxisY2"), PersistenceMode(PersistenceMode.InnerProperty), SRCategory("CategoryAttributeAxis")]
		public Axis AxisY2
		{
			get
			{
				return this.axisY2;
			}
			set
			{
				this.axisY2 = value;
				this.axisY2.Initialize(this, AxisName.Y2);
				this._axisArray[3] = this.axisY2;
				this.Invalidate();
			}
		}

		[Editor(typeof(ChartColorEditor), typeof(UITypeEditor)), DefaultValue(typeof(Color), ""), PersistenceMode(PersistenceMode.Attribute), Bindable(true), SRDescription("DescriptionAttributeBackColor"), NotifyParentProperty(true), TypeConverter(typeof(ColorConverter)), SRCategory("CategoryAttributeAppearance")]
		public Color BackColor
		{
			get
			{
				return this._backColor;
			}
			set
			{
				this._backColor = value;
				this.Invalidate();
			}
		}

		[SRCategory("CategoryAttributeAppearance"), Bindable(true), NotifyParentProperty(true), SRDescription("DescriptionAttributeBackGradientStyle"), PersistenceMode(PersistenceMode.Attribute), Editor(typeof(GradientEditor), typeof(UITypeEditor)), DefaultValue(0)]
		public GradientStyle BackGradientStyle
		{
			get
			{
				return this._backGradientStyle;
			}
			set
			{
				this._backGradientStyle = value;
				this.Invalidate();
			}
		}

		[Editor(typeof(HatchStyleEditor), typeof(UITypeEditor)), SRCategory("CategoryAttributeAppearance"), Bindable(true), DefaultValue(0), NotifyParentProperty(true), SRDescription("DescriptionAttributeBackHatchStyle"), PersistenceMode(PersistenceMode.Attribute)]
		public ChartHatchStyle BackHatchStyle
		{
			get
			{
				return this._backHatchStyle;
			}
			set
			{
				this._backHatchStyle = value;
				this.Invalidate();
			}
		}

		[DefaultValue(""), SRCategory("CategoryAttributeAppearance"), NotifyParentProperty(true), PersistenceMode(PersistenceMode.Attribute), SRDescription("DescriptionAttributeBackImage"), Bindable(true), Editor(typeof(ImageValueEditor), typeof(UITypeEditor))]
		public string BackImage
		{
			get
			{
				return this._backImage;
			}
			set
			{
				this._backImage = value;
				this.Invalidate();
			}
		}

		[PersistenceMode(PersistenceMode.Attribute), SRCategory("CategoryAttributeAppearance"), Bindable(true), DefaultValue(0), NotifyParentProperty(true), SRDescription("DescriptionAttributeBackImageAlign")]
		public ChartImageAlignmentStyle BackImageAlignment
		{
			get
			{
				return this._backImageAlignment;
			}
			set
			{
				this._backImageAlignment = value;
				this.Invalidate();
			}
		}

		[SRDescription("DescriptionAttributeImageTransparentColor"), Editor(typeof(ChartColorEditor), typeof(UITypeEditor)), PersistenceMode(PersistenceMode.Attribute), DefaultValue(typeof(Color), ""), NotifyParentProperty(true), SRCategory("CategoryAttributeAppearance"), TypeConverter(typeof(ColorConverter)), Bindable(true)]
		public Color BackImageTransparentColor
		{
			get
			{
				return this._backImageTransparentColor;
			}
			set
			{
				this._backImageTransparentColor = value;
				this.Invalidate();
			}
		}

		[NotifyParentProperty(true), PersistenceMode(PersistenceMode.Attribute), Bindable(true), DefaultValue(0), SRCategory("CategoryAttributeAppearance"), SRDescription("DescriptionAttributeImageWrapMode")]
		public ChartImageWrapMode BackImageWrapMode
		{
			get
			{
				return this._backImageWrapMode;
			}
			set
			{
				this._backImageWrapMode = value;
				this.Invalidate();
			}
		}

		[Bindable(true), DefaultValue(typeof(Color), ""), NotifyParentProperty(true), SRDescription("DescriptionAttributeBackSecondaryColor"), TypeConverter(typeof(ColorConverter)), Editor(typeof(ChartColorEditor), typeof(UITypeEditor)), PersistenceMode(PersistenceMode.Attribute), SRCategory("CategoryAttributeAppearance")]
		public Color BackSecondaryColor
		{
			get
			{
				return this._backSecondaryColor;
			}
			set
			{
				this._backSecondaryColor = value;
				this.Invalidate();
			}
		}

		[SRDescription("DescriptionAttributeBorderColor"), SRCategory("CategoryAttributeAppearance"), NotifyParentProperty(true), TypeConverter(typeof(ColorConverter)), Editor(typeof(ChartColorEditor), typeof(UITypeEditor)), PersistenceMode(PersistenceMode.Attribute), Bindable(true), DefaultValue(typeof(Color), "Black")]
		public Color BorderColor
		{
			get
			{
				return this._borderColor;
			}
			set
			{
				this._borderColor = value;
				this.Invalidate();
			}
		}

		[NotifyParentProperty(true), SRDescription("DescriptionAttributeBorderDashStyle"), PersistenceMode(PersistenceMode.Attribute), SRCategory("CategoryAttributeAppearance"), Bindable(true), DefaultValue(0)]
		public ChartDashStyle BorderDashStyle
		{
			get
			{
				return this._borderDashStyle;
			}
			set
			{
				this._borderDashStyle = value;
				this.Invalidate();
			}
		}

		[SRCategory("CategoryAttributeAppearance"), PersistenceMode(PersistenceMode.Attribute), Bindable(true), DefaultValue(1), SRDescription("DescriptionAttributeBorderWidth"), NotifyParentProperty(true)]
		public int BorderWidth
		{
			get
			{
				return this._borderWidth;
			}
			set
			{
				if (value < 0)
				{
					throw new ArgumentOutOfRangeException("value", SR.ExceptionBorderWidthIsNegative);
				}
				this._borderWidth = value;
				this.Invalidate();
			}
		}

		internal ArrayList ChartTypes
		{
			get
			{
				return this.chartTypes;
			}
		}

		internal int CircularSectorsNumber
		{
			get
			{
				if (this._circularSectorNumber == -2147483648)
				{
					this._circularSectorNumber = this.GetCircularSectorNumber();
				}
				return this._circularSectorNumber;
			}
		}

		internal bool CircularUsePolygons
		{
			get
			{
				if (this._circularUsePolygons == -2147483648)
				{
					this._circularUsePolygons = 0;
					foreach (var series in base.Common.DataManager.Series)
					{
						if (((series.ChartArea == this.Name) && series.IsVisible()) && series.IsCustomPropertySet("AreaDrawingStyle"))
						{
							if (string.Compare(series["AreaDrawingStyle"], "Polygon", StringComparison.OrdinalIgnoreCase) != 0)
							{
								if (string.Compare(series["AreaDrawingStyle"], "Circle", StringComparison.OrdinalIgnoreCase) != 0)
									throw new InvalidOperationException(SR.ExceptionCustomAttributeValueInvalid(series["AreaDrawingStyle"], "AreaDrawingStyle"));

								this._circularUsePolygons = 0;
							}
							else
							{
								this._circularUsePolygons = 1;
							}
							break;
						}
					}
				}
				return (this._circularUsePolygons == 1);
			}
		}

		[SRDescription("DescriptionAttributeChartArea_InnerPlotPosition"), PersistenceMode(PersistenceMode.InnerProperty), NotifyParentProperty(true), TypeConverter(typeof(ElementPositionConverter)), SerializationVisibility(SerializationVisibility.Element), Bindable(true), SRCategory("CategoryAttributeAppearance")]
		public ElementPosition InnerPlotPosition
		{
			get
			{
				if (((base.Common == null) || (base.Common.Chart == null)) || (base.Common.Chart.SerializationStatus != SerializationStatus.Saving))
				{
					return this._innerPlotPosition;
				}
				if (this._innerPlotPosition.Auto)
				{
					return new ElementPosition();
				}
				ElementPosition position = new ElementPosition();
				position.Auto = true;
				position.SetPositionNoAuto(this._innerPlotPosition.X, this._innerPlotPosition.Y, this._innerPlotPosition.Width, this._innerPlotPosition.Height);
				return position;
			}
			set
			{
				this._innerPlotPosition = value;
				this._innerPlotPosition.Parent = this;
				this.Invalidate();
			}
		}

		[SRCategory("CategoryAttributeAppearance"), DefaultValue(false), SRDescription("DescriptionAttributeChartArea_EquallySizedAxesFont"), NotifyParentProperty(true), Bindable(true), PersistenceMode(PersistenceMode.Attribute)]
		public bool IsSameFontSizeForAllAxes
		{
			get
			{
				return this._isSameFontSizeForAllAxes;
			}
			set
			{
				this._isSameFontSizeForAllAxes = value;
				this.Invalidate();
			}
		}

		internal bool IsSubAxesSupported
		{
			get
			{
				return (!this.Area3DStyle.Enable3D && !this.chartAreaIsCurcular);
			}
		}

		[SRDescription("DescriptionAttributeChartArea_Name"), Bindable(true), PersistenceMode(PersistenceMode.Attribute), SRCategory("CategoryAttributeMisc"), NotifyParentProperty(true)]
		public override string Name
		{
			get
			{
				return base.Name;
			}
			set
			{
				base.Name = value;
			}
		}

		[SerializationVisibility(SerializationVisibility.Element), SRDescription("DescriptionAttributeChartArea_Position"), NotifyParentProperty(true), TypeConverter(typeof(ElementPositionConverter)), SRCategory("CategoryAttributeAppearance"), PersistenceMode(PersistenceMode.InnerProperty), Bindable(true)]
		public ElementPosition Position
		{
			get
			{
				if ((base.Chart == null) || (base.Chart.SerializationStatus != SerializationStatus.Saving))
				{
					return this._areaPosition;
				}
				if (this._areaPosition.Auto)
				{
					return new ElementPosition();
				}
				ElementPosition position = new ElementPosition();
				position.Auto = true;
				position.SetPositionNoAuto(this._areaPosition.X, this._areaPosition.Y, this._areaPosition.Width, this._areaPosition.Height);
				return position;
			}
			set
			{
				this._areaPosition = value;
				this._areaPosition.Parent = this;
				this._areaPosition.resetAreaAutoPosition = true;
				this.Invalidate();
			}
		}

		internal bool ReverseSeriesOrder
		{
			get
			{
				return this._reverseSeriesOrder;
			}
		}

		internal List<string> Series
		{
			get
			{
				return this._series;
			}
		}

		[NotifyParentProperty(true), DefaultValue(typeof(Color), "128,0,0,0"), SRDescription("DescriptionAttributeShadowColor"), SRCategory("CategoryAttributeAppearance"), TypeConverter(typeof(ColorConverter)), Editor(typeof(ChartColorEditor), typeof(UITypeEditor)), PersistenceMode(PersistenceMode.Attribute), Bindable(true)]
		public Color ShadowColor
		{
			get
			{
				return this._shadowColor;
			}
			set
			{
				this._shadowColor = value;
				this.Invalidate();
			}
		}

		[SRDescription("DescriptionAttributeShadowOffset"), DefaultValue(0), NotifyParentProperty(true), PersistenceMode(PersistenceMode.Attribute), SRCategory("CategoryAttributeAppearance"), Bindable(true)]
		public int ShadowOffset
		{
			get
			{
				return this._shadowOffset;
			}
			set
			{
				this._shadowOffset = value;
				this.Invalidate();
			}
		}

		internal ArrayList StackGroupNames
		{
			get
			{
				return this._stackGroupNames;
			}
		}

		[ParenthesizePropertyName(true), SRCategory("CategoryAttributeAppearance"), DefaultValue(true), SRDescription("DescriptionAttributeChartArea_Visible")]
		public virtual bool Visible
		{
			get
			{
				return this._visible;
			}
			set
			{
				this._visible = value;
				this.Invalidate();
			}
		}

		internal class ChartTypeAndSeriesInfo
		{
			internal string ChartType;
			internal Series Series;

			public ChartTypeAndSeriesInfo()
			{
				this.ChartType = string.Empty;
			}

			public ChartTypeAndSeriesInfo(string chartType)
			{
				this.ChartType = string.Empty;
				this.ChartType = chartType;
			}

			public ChartTypeAndSeriesInfo(Series series)
			{
				this.ChartType = string.Empty;
				this.ChartType = series.ChartTypeName;
				this.Series = series;
			}
		}

		internal class PointsDrawingOrderComparer : IComparer
		{
			private ChartArea _area;
			private Point3D _areaProjectionCenter = new Point3D(float.NaN, float.NaN, float.NaN);
			private bool _selection;

			public PointsDrawingOrderComparer(ChartArea area, bool selection, COPCoordinates coord)
			{
				this._area = area;
				this._selection = selection;
				if (area.DrawPointsToCenter(ref coord))
				{
					this._areaProjectionCenter = area.GetCenterOfProjection(coord);
				}
			}

			public int Compare(object o1, object o2)
			{
				DataPoint3D pointd = (DataPoint3D)o1;
				DataPoint3D pointd2 = (DataPoint3D)o2;
				int num = 0;
				if (pointd.xPosition < pointd2.xPosition)
				{
					num = -1;
				}
				else if (pointd.xPosition > pointd2.xPosition)
				{
					num = 1;
				}
				else
				{
					if (pointd.yPosition < pointd2.yPosition)
					{
						num = 1;
					}
					else if (pointd.yPosition > pointd2.yPosition)
					{
						num = -1;
					}
					if (!float.IsNaN(this._areaProjectionCenter.Y))
					{
						double num2 = Math.Min(pointd.yPosition, pointd.height);
						double num3 = Math.Max(pointd.yPosition, pointd.height);
						double num4 = Math.Min(pointd2.yPosition, pointd2.height);
						double num5 = Math.Max(pointd2.yPosition, pointd2.height);
						if (this._area.IsBottomSceneWallVisible())
						{
							if ((num2 <= this._areaProjectionCenter.Y) && (num4 <= this._areaProjectionCenter.Y))
							{
								num *= -1;
							}
							else if (num2 <= this._areaProjectionCenter.Y)
							{
								num = 1;
							}
						}
						else if ((num3 >= this._areaProjectionCenter.Y) && (num5 >= this._areaProjectionCenter.Y))
						{
							num = num;
						}
						else if (num3 >= this._areaProjectionCenter.Y)
						{
							num = 1;
						}
						else
						{
							num *= -1;
						}
					}
					else if (!this._area.IsBottomSceneWallVisible())
					{
						num *= -1;
					}
				}
				if (pointd.xPosition != pointd2.xPosition)
				{
					if (!float.IsNaN(this._areaProjectionCenter.X))
					{
						if (((pointd.xPosition + (pointd.width / 2.0)) >= this._areaProjectionCenter.X) && ((pointd2.xPosition + (pointd2.width / 2.0)) >= this._areaProjectionCenter.X))
						{
							num *= -1;
						}
					}
					else if (this._area.DrawPointsInReverseOrder())
					{
						num *= -1;
					}
				}
				if (!this._selection)
				{
					return num;
				}
				return -num;
			}
		}
	}
}

